mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 23:48:05 +08:00
tests: Pass correct length for buffer
This allocated 64 bytes and then told snprinf it was 128. That's a no-no even if we never need that much.
This commit is contained in:
parent
66c6e89f98
commit
1f2e0617d1
|
@ -123,7 +123,7 @@ fn test_format() {
|
|||
let mut buff1 = [0_u8; 64];
|
||||
let mut buff2 = [0_u8; 64];
|
||||
format_llong_safe(&mut buff1, q);
|
||||
unsafe { libc::snprintf(buff2.as_mut_ptr().cast(), 128, "%ld\0".as_ptr().cast(), q) };
|
||||
unsafe { libc::snprintf(buff2.as_mut_ptr().cast(), 64, "%ld\0".as_ptr().cast(), q) };
|
||||
assert_eq!(cstr2wcstring(&buff1), cstr2wcstring(&buff2));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user