]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
pool: Fix a potential NULL pointer de-reference in test code
authorFrank Lichtenheld <frank@lichtenheld.com>
Fri, 8 May 2026 15:31:51 +0000 (17:31 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 13 May 2026 09:12:13 +0000 (11:12 +0200)
Identified by cppcheck. Probably has been a long time
since that code has been compiled, though.

Change-Id: I09ebbf6f3555dd68ce8d75bfa844ecac518a0cf2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1676
Message-Id: <20260508153156.13575-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36865.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/pool.c

index 15004c0b30f325eda477177ed0d70832e62f7341..ff74e7ce6a8f19586fab730c2876749fc5aeb9b8 100644 (file)
@@ -757,7 +757,7 @@ ifconfig_pool_test(in_addr_t start, in_addr_t end)
             break;
         }
         msg(M_INFO | M_NOPREFIX, "IFCONFIG_POOL TEST pass 1: l=%s r=%s cn=%s",
-            print_in_addr_t(local, 0, &gc), print_in_addr_t(remote, 0, &gc), cn);
+            print_in_addr_t(local, 0, &gc), print_in_addr_t(remote, 0, &gc), cn ? cn : "[NULL]");
         array[i] = h;
     }
 
@@ -793,7 +793,7 @@ ifconfig_pool_test(in_addr_t start, in_addr_t end)
             break;
         }
         msg(M_INFO | M_NOPREFIX, "IFCONFIG_POOL TEST pass 3: l=%s r=%s cn=%s",
-            print_in_addr_t(local, 0, &gc), print_in_addr_t(remote, 0, &gc), cn);
+            print_in_addr_t(local, 0, &gc), print_in_addr_t(remote, 0, &gc), cn ? cn : "[NULL]");
         array[i] = h;
     }