From: Gert Doering Date: Thu, 13 Aug 2020 10:13:01 +0000 (+0200) Subject: Fix stack overflow in OpenSolaris NEXTADDR() X-Git-Tag: v2.6_beta1~723 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e65483d1227adfb855844467e4d30894ffc355d;p=thirdparty%2Fopenvpn.git 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 --- 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)))