Skip to contentSkip to conversation

Fix undefined signed shift overflow

PATCH In review Michael McConville 2 participants 2 messages Feb 2, 2016 – Feb 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix undefined signed shift overflow

Originally discussed here:

https://github.com/OpenVPN/openvpn/pull/42

Thanks for your time,
Michael

src/openvpn/route.c +4 -2
index 2012b5c..f4dee78 100644
@@ -3128,7 +3128,8 @@ get_default_gateway (struct route_gateway_info *rgi)
   struct gc_arena gc = gc_new ();
   struct rtmsg m_rtmsg;
   int sockfd = -1;
-  int seq, l, pid, rtm_addrs, i;
+  int seq, l, pid, rtm_addrs;
+  unsigned int i;
   struct sockaddr so_dst, so_mask;
   char *cp = m_rtmsg.m_space; 
   struct sockaddr *gate = NULL, *ifp = NULL, *sa;
@@ -3330,7 +3331,8 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
 
     struct rtmsg m_rtmsg;
     int sockfd = -1;
-    int seq, l, pid, rtm_addrs, i;
+    int seq, l, pid, rtm_addrs;
+    unsigned int i;
     struct sockaddr_in6 so_dst, so_mask;
     char *cp = m_rtmsg.m_space;
     struct sockaddr *gate = NULL, *ifp = NULL, *sa;
#1 lore raw

ACK, thanks for sending it to the list.

Your patch has been applied to the master and release/2.3 branch (manually applying to release/2.3 as the code there has three copies of the offending IPv4 code, and the IPv6 code isn't there yet...)

Tested on FreeBSD 10.1 ("openvpn --show-gateway")

commit d4d5d9259aeba152d5969fea048267fc97ca7530 (master) commit d9eeaab65373a4a4d7511b9bac2dec90b1afed4f (release/2.3)

Author: Michael McConville
Date:   Tue Feb 2 14:11:22 2016 -0500
     Fix undefined signed shift overflow

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/11050
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering