]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix check if iface name is set
authorArne Schwabe <arne@rfc2549.org>
Thu, 15 Aug 2019 12:10:52 +0000 (14:10 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 15 Aug 2019 12:40:17 +0000 (14:40 +0200)
Clang/Android complained

 warning: address of array 'rgi6->iface' will always evaluate to 'true'
[-Wpointer-bool-conversion]
          if (rgi6->iface)

iface is a char[16]; So its pointer is always true.

we do a CLEAR(rgi6) always before setting this struct and strcpy the
name into iface. So using strlen instead of checking for the pointer
should be the right fix.

Patch V2: use if(strlen > 0) instead of if(strlen)

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20190815121053.18433-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20190815121053.18433-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/route.c

index bf0366894af038dc086e29f3a975d74f2281634c..dac472151cccdee5bf2c576a485921231d7337e2 100644 (file)
@@ -3338,7 +3338,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
             rgi6->flags |= RGI_ADDR_DEFINED;
         }
 
-        if (rgi6->iface)
+        if (strlen(rgi6->iface) > 0)
         {
             rgi6->flags |= RGI_IFACE_DEFINED;
         }