Skip to content

Commit aba5e69

Browse files
committed
zdtm/chroot: allocate enough memory for a path
==36==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000001c at pc 0x7fb26c88d5f9 bp 0x7ffc15087d40 sp 0x7ffc150874d0 WRITE of size 13 at 0x60200000001c thread T0 #0 0x7fb26c88d5f8 in vsprintf (/lib64/libasan.so.4+0x9e5f8) #1 0x7fb26c88d986 in __interceptor_sprintf (/lib64/libasan.so.4+0x9e986) #2 0x402453 in main /root/git/main/criu/test/zdtm/static/chroot.c:68 #3 0x7fb26c43e4d9 in __libc_start_main (/lib64/libc.so.6+0x204d9) #4 0x4031b9 in _start (/root/git/main/criu/test/zdtm/static/chroot+0x4031b9) Signed-off-by: Andrei Vagin <[email protected]>
1 parent 0fcb724 commit aba5e69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/zdtm/static/chroot.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
6464

6565
test_init(argc, argv);
6666

67-
filepath = malloc(strlen(filename) + 1);
67+
filepath = malloc(strlen(filename) + 2);
6868
sprintf(filepath, "/%s", filename);
6969

7070
pipe(pipe_prep);

0 commit comments

Comments
 (0)