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 <richardcochran@gmail.com>master
parent
150da0cba9
commit
a9e88a0a49
1
udp.c
1
udp.c
|
@ -257,6 +257,7 @@ static int receive(int fd, void *buf, int buflen,
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct timespec *ts = NULL;
|
struct timespec *ts = NULL;
|
||||||
|
|
||||||
|
memset(control, 0, sizeof(control));
|
||||||
memset(&msg, 0, sizeof(msg));
|
memset(&msg, 0, sizeof(msg));
|
||||||
msg.msg_iov = &iov;
|
msg.msg_iov = &iov;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
|
|
Loading…
Reference in New Issue