From 936bd82755e8f75fc09c1e9a67fb390175b157d4 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sat, 12 Oct 2019 23:29:59 +0100 Subject: [PATCH] Fix too small control array in tftp code on BSD and SOLARIS This causes tftp to fail on some BSD versions, for sure. It works by chance on others. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241068 --- src/tftp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tftp.c b/src/tftp.c index 435b216..c618a2c 100644 --- a/src/tftp.c +++ b/src/tftp.c @@ -68,9 +68,11 @@ void tftp_request(struct listener *listen, time_t now) #if defined(HAVE_LINUX_NETWORK) char control[CMSG_SPACE(sizeof(struct in_pktinfo))]; #elif defined(HAVE_SOLARIS_NETWORK) - char control[CMSG_SPACE(sizeof(unsigned int))]; + char control[CMSG_SPACE(sizeof(struct in_addr)) + + CMSG_SPACE(sizeof(unsigned int))]; #elif defined(IP_RECVDSTADDR) && defined(IP_RECVIF) - char control[CMSG_SPACE(sizeof(struct sockaddr_dl))]; + char control[CMSG_SPACE(sizeof(struct in_addr)) + + CMSG_SPACE(sizeof(struct sockaddr_dl))]; #endif } control_u;