fix crash due to out of bounds string->i32 parsing in tp command
All checks were successful
Build, test and push / lib_clippy (push) Successful in 37s
Build, test and push / server_clippy (push) Successful in 41s
Build, test and push / server_test (push) Successful in 58s
Build, test and push / lib_test (push) Successful in 59s
Build, test and push / build_server_docker_image (push) Successful in 3m23s
Build, test and push / push_server (push) Successful in 23s

This commit is contained in:
TheTxT 2025-08-29 19:50:11 +02:00
parent e558ca67d7
commit d40b19f499

View file

@ -51,11 +51,11 @@ fn execute(command: String, stream: Option<&mut TcpStream>, game: &mut Game, con
} else {
let mut arg_iter = arg_string.split(" ");
let x = arg_iter.next().unwrap_or_default();
let x: i32 = str::parse(x).unwrap();
let x: i32 = str::parse(x).unwrap_or_default(); //TODO: parsing needs proper bounds checking
let y = arg_iter.next().unwrap_or_default();
let y: i32 = str::parse(y).unwrap();
let y: i32 = str::parse(y).unwrap_or_default();
let z = arg_iter.next().unwrap_or_default();
let z: i32 = str::parse(z).unwrap();
let z: i32 = str::parse(z).unwrap_or_default();
(x as f64, y as f64, z as f64, 0.0, 0.0)
};