From a9e88a0a49a418e149c64e786543edff12040868 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 11 Mar 2012 09:45:23 +0100 Subject: [PATCH] Fix segfault after missing transmit time stamp. If the networking stack fails to provide a transmit time stamp, then we might feed uninitialized stack data to the CMSG(3) macros. This can result in a segfault or other badness. The fix is to simply clear the control buffer in advance. Signed-off-by: Richard Cochran --- udp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udp.c b/udp.c index 8a3dc7b..d097f98 100644 --- a/udp.c +++ b/udp.c @@ -257,6 +257,7 @@ static int receive(int fd, void *buf, int buflen, struct msghdr msg; struct timespec *ts = NULL; + memset(control, 0, sizeof(control)); memset(&msg, 0, sizeof(msg)); msg.msg_iov = &iov; msg.msg_iovlen = 1;