From 7e65483d1227adfb855844467e4d30894ffc355d Mon Sep 17 00:00:00 2001 From: Gert Doering Date: Thu, 13 Aug 2020 12:13:01 +0200 Subject: [PATCH] Fix stack overflow in OpenSolaris NEXTADDR() Commit 5fde831c5807 fixed NEXTADDR() for all *BSDs and MacOS. OpenSolaris has to use a slightly different macro due to lack of sockaddr->sa_len - but it has the same problem, first rounding up, then memmove()'ing. Switch order. Signed-off-by: Gert Doering Acked-by: Arne Schwabe Message-Id: <20200813101301.12720-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20731.html Signed-off-by: Gert Doering --- src/openvpn/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 24563ed63..f127a90aa 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3429,7 +3429,7 @@ struct rtmsg { #if defined(TARGET_SOLARIS) #define NEXTADDR(w, u) \ if (rtm_addrs & (w)) { \ - l = ROUNDUP(sizeof(u)); memmove(cp, &(u), l); cp += l; \ + l = sizeof(u); memmove(cp, &(u), l); cp += ROUNDUP(l); \ } #define ADVANCE(x, n) (x += ROUNDUP(sizeof(struct sockaddr_in))) -- 2.47.2