From f7a99acb4eac23223f51ce83b8081cc9695fef1e Mon Sep 17 00:00:00 2001 From: Pavel Tvrdik Date: Tue, 3 May 2016 09:32:49 +0200 Subject: [PATCH] Initialize variable ifr in sk_setup() ==00:00:00:02.831 2468== Syscall param socketcall.setsockopt(optval) points to uninitialised byte(s) ==00:00:00:02.831 2468== at 0x513BDEA: setsockopt (in /usr/lib/libc-2.23.so) ==00:00:00:02.831 2468== by 0x45C7AF: sk_setup (io.c:1216) ==00:00:00:02.831 2468== by 0x45CDFF: sk_open (io.c:1417) ==00:00:00:02.831 2468== by 0x44B562: rip_open_socket (packets.c:740) ==00:00:00:02.831 2468== by 0x4481A7: rip_iface_locked (rip.c:616) ==00:00:00:02.831 2468== by 0x4133E4: olock_run_event (locks.c:177) ==00:00:00:02.831 2468== by 0x45A6DE: ev_run (event.c:85) ==00:00:00:02.831 2468== by 0x45A7AD: ev_run_list (event.c:142) ==00:00:00:02.831 2468== by 0x45E0FC: io_loop (io.c:2066) ==00:00:00:02.831 2468== by 0x463B56: main (main.c:845) ==00:00:00:02.831 2468== Address 0xffefffd24 is on thread 1's stack ==00:00:00:02.831 2468== in frame #1, created by sk_setup (io.c:1188) ==00:00:00:02.831 2468== Uninitialised value was created by a stack allocation ==00:00:00:02.831 2468== at 0x45C6BB: sk_setup (io.c:1188) --- sysdep/unix/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index d918d321..82f6c69e 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1211,7 +1211,7 @@ sk_setup(sock *s) if (s->iface) { #ifdef SO_BINDTODEVICE - struct ifreq ifr; + struct ifreq ifr = {}; strcpy(ifr.ifr_name, s->iface->name); if (setsockopt(s->fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0) ERR("SO_BINDTODEVICE");