Update rust/ql/src/queries/security/CWE-770/UncontrolledAllocationSizeGood.rs

Co-authored-by: Simon Friis Vindum <paldepind@github.com>
This commit is contained in:
Geoffrey White
2025-04-04 09:53:13 +01:00
committed by GitHub
parent fb22d55878
commit f96b00a62a

View File

@@ -3,7 +3,7 @@ const BUFFER_LIMIT: usize = 10 * 1024;
fn allocate_buffer(user_input: String) -> Result<*mut u8, Error> {
let size = user_input.parse::<usize>()?;
if (size > BUFFER_LIMIT) {
if size > BUFFER_LIMIT {
return Err("Size exceeds limit".into());
}
let num_bytes = size * std::mem::size_of::<u64>();