Skip to content

Commit

Permalink
zdtm/chroot: allocate enough memory for a path
Browse files Browse the repository at this point in the history
==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 <avagin@virtuozzo.com>
  • Loading branch information
avagin committed Oct 17, 2017
1 parent d50f0e9 commit 4776182
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/zdtm/static/chroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char **argv)

test_init(argc, argv);

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

pipe(pipe_prep);
Expand Down

0 comments on commit 4776182

Please sign in to comment.