Skip to contentSkip to conversation

Change in openvpn[master]: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMes...

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Jan 27 – Mar 6 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1769513463000.I03f4c640a2adbea9bbb6f6334f12375041ec429c@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email

to review the following change.

Change subject: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
......................................................................

openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id I03f4c640a2adbea9bbb6f6334f12375041ec429c

---
M src/openvpnserv/interactive.c

1 file changed, 5 insertions(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1496/1

src/openvpnserv/interactive.c +5 -10
index 227431a..09c709e 100644
@@ -1247,11 +1247,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  * Check for a valid search list in a certain key of the registry
  *
@@ -2944,7 +2939,11 @@
     int addr_len = msg->addr_len;
 
     /* sanity check */
-    if (addr_len > _countof(msg->addr))
+    if (addr_len < 0)
+    {
+        addr_len = 0;
+    }
+    if ((unsigned int)addr_len > _countof(msg->addr))
     {
         addr_len = _countof(msg->addr);
     }
@@ -3005,10 +3004,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static DWORD
 HandleEnableDHCPMessage(const enable_dhcp_message_t *dhcp)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Gerrit-Change-Number: 1496
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email )

Change subject: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Gerrit-Change-Number: 1496
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 05 Mar 2026 08:45:47 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH v5 1/1 openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id I03f4c640a2adbea9bbb6f6334f12375041ec429c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
This mail reflects revision 5 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpnserv/interactive.c +5 -10
index 227431a..09c709e 100644
@@ -1247,11 +1247,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  * Check for a valid search list in a certain key of the registry
  *
@@ -2944,7 +2939,11 @@
     int addr_len = msg->addr_len;
 
     /* sanity check */
-    if (addr_len > _countof(msg->addr))
+    if (addr_len < 0)
+    {
+        addr_len = 0;
+    }
+    if ((unsigned int)addr_len > _countof(msg->addr))
     {
         addr_len = _countof(msg->addr);
     }
@@ -3005,10 +3004,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static DWORD
 HandleEnableDHCPMessage(const enable_dhcp_message_t *dhcp)
 {
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Stared-at-code, reasonable change. Make checks explicit. Compiler happy, BB happy. One #pragma gone, Gert happy.

Your patch has been applied to the master branch.

commit be26f9a28c38d9c190388d3922db79a3957bb74d

Author: Frank Lichtenheld
Date:   Thu Mar 5 09:46:04 2026 +0100
     openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35923.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello cron2, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email

to look at the new patch set (#6).

The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.

Change subject: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
......................................................................

openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id I03f4c640a2adbea9bbb6f6334f12375041ec429c

---
M src/openvpnserv/interactive.c

1 file changed, 5 insertions(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1496/6

src/openvpnserv/interactive.c +5 -10
index 227431a..09c709e 100644
@@ -1247,11 +1247,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  * Check for a valid search list in a certain key of the registry
  *
@@ -2944,7 +2939,11 @@
     int addr_len = msg->addr_len;
 
     /* sanity check */
-    if (addr_len > _countof(msg->addr))
+    if (addr_len < 0)
+    {
+        addr_len = 0;
+    }
+    if ((unsigned int)addr_len > _countof(msg->addr))
     {
         addr_len = _countof(msg->addr);
     }
@@ -3005,10 +3004,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static DWORD
 HandleEnableDHCPMessage(const enable_dhcp_message_t *dhcp)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Gerrit-Change-Number: 1496
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#7) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
......................................................................

openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id I03f4c640a2adbea9bbb6f6334f12375041ec429c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35923.html

---
M src/openvpnserv/interactive.c

1 file changed, 5 insertions(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1496/7

src/openvpnserv/interactive.c +5 -10
index 227431a..09c709e 100644
@@ -1247,11 +1247,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  * Check for a valid search list in a certain key of the registry
  *
@@ -2944,7 +2939,11 @@
     int addr_len = msg->addr_len;
 
     /* sanity check */
-    if (addr_len > _countof(msg->addr))
+    if (addr_len < 0)
+    {
+        addr_len = 0;
+    }
+    if ((unsigned int)addr_len > _countof(msg->addr))
     {
         addr_len = _countof(msg->addr);
     }
@@ -3005,10 +3004,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static DWORD
 HandleEnableDHCPMessage(const enable_dhcp_message_t *dhcp)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Gerrit-Change-Number: 1496
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email )

Change subject: openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
......................................................................

openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id I03f4c640a2adbea9bbb6f6334f12375041ec429c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35923.html

---
M src/openvpnserv/interactive.c

1 file changed, 5 insertions(+), 10 deletions(-)
src/openvpnserv/interactive.c +5 -10
index 227431a..09c709e 100644
@@ -1247,11 +1247,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  * Check for a valid search list in a certain key of the registry
  *
@@ -2944,7 +2939,11 @@
     int addr_len = msg->addr_len;
 
     /* sanity check */
-    if (addr_len > _countof(msg->addr))
+    if (addr_len < 0)
+    {
+        addr_len = 0;
+    }
+    if ((unsigned int)addr_len > _countof(msg->addr))
     {
         addr_len = _countof(msg->addr);
     }
@@ -3005,10 +3004,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static DWORD
 HandleEnableDHCPMessage(const enable_dhcp_message_t *dhcp)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1496?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Gerrit-Change-Number: 1496
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>