Use calloc instead of malloc for initialization purposes.
Sami Kerola <email@example.com> provided a patch but before applying it
I reorderd the calloc arguments to match the documented calloc() API.
Concerning the issue, Sami writes:
"While checking ping(1) with address sanitizer I came across with libcap
error. Looking the code this error might be false positive, but I think it
is good idea to clear out the error so that people using address sanitizer
are not tripped over by a library due something that is easy to avoid.
Uninitialized bytes in __interceptor_capget at offset 0 inside [0x703000000004, 8)
==5700==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f83109eb79a in cap_init /home/src/libcap/libcap/cap_alloc.c:32:5
#1 0x7f83109eb835 in cap_get_proc /home/src/libcap/libcap/cap_proc.c:16:14
#2 0x556168d34936 in limit_capabilities /home/src/iputils/builddir/../ping_common.c:158:14
#3 0x556168d1b784 in main /home/src/iputils/builddir/../ping.c:203:2
#4 0x7f830f7a406a in __libc_start_main (/usr/lib/libc.so.6+0x2306a)
#5 0x556168c96f29 in _start (/home/src/iputils/builddir/ping+0x31f29)"
Signed-off-by: Andrew G. Morgan <firstname.lastname@example.org>
1 file changed