Skip to contentSkip to conversation

Change in openvpn[master]: iservice: make sure buffer size is not zero

Openvpn-devel In review d12fk (Code Review) 2 participants 6 messages Nov 23, 2025 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.1763880426000.I8b26c65415f5a751f416d80a22cbb7ff14aa27c0@...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/+/1389?usp=email

to review the following change.

Change subject: iservice: make sure buffer size is not zero
......................................................................

iservice: make sure buffer size is not zero

GetItfDnsDomains expects a non-zero size buffer to return the domains in. Check for the size as well, not just for a valid pointer.

Change-Id I8b26c65415f5a751f416d80a22cbb7ff14aa27c0

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/89/1389/1

src/openvpnserv/interactive.c +1 -1
index f64c247..d778e89 100644
@@ -2149,7 +2149,7 @@
 static LSTATUS
 GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size)
 {
-    if (domains == NULL || size == 0)
+    if (domains == NULL || size == NULL || *size == 0)
     {
         return ERROR_INVALID_PARAMETER;
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1389?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: I8b26c65415f5a751f416d80a22cbb7ff14aa27c0
Gerrit-Change-Number: 1389
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[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: d12fk, plaisthos.

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

Change subject: iservice: make sure buffer size is not zero
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1389?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: I8b26c65415f5a751f416d80a22cbb7ff14aa27c0
Gerrit-Change-Number: 1389
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[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: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 23 Nov 2025 11:37:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 iservice: make sure buffer size is not zero

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

GetItfDnsDomains expects a non-zero size buffer to return the domains in. Check for the size as well, not just for a valid pointer.

Change-Id I8b26c65415f5a751f416d80a22cbb7ff14aa27c0

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

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/+/1389
This mail reflects revision 1 of this Change.

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

src/openvpnserv/interactive.c +1 -1
index f64c247..d778e89 100644
@@ -2149,7 +2149,7 @@
 static LSTATUS
 GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size)
 {
-    if (domains == NULL || size == 0)
+    if (domains == NULL || size == NULL || *size == 0)
     {
         return ERROR_INVALID_PARAMETER;
     }
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: iservice: make sure buffer size is not zero

Trivial enough.

While this cannot happen today (the single caller passes in *size = sizeof(data[0].domains)), who knows what the next refactoring might bring...

Not tested beyond "does BB confirm it compiles" - it does. The failed checks in BB look more like "something in one part of the build infra is eating UDP fragments again" (some workers consistently fail t_client, while all others are fine).

Your patch has been applied to the master branch.

commit c20a960a338a2e6e7436260cdae4d6eef298cfb0

Author: Heiko Hund
Date:   Sun Nov 23 12:37:42 2025 +0100
     iservice: make sure buffer size is not zero

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1389
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34606.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

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

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

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

Change subject: iservice: make sure buffer size is not zero
......................................................................

iservice: make sure buffer size is not zero

GetItfDnsDomains expects a non-zero size buffer to return the domains in. Check for the size as well, not just for a valid pointer.

Change-Id I8b26c65415f5a751f416d80a22cbb7ff14aa27c0

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

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/89/1389/2

src/openvpnserv/interactive.c +1 -1
index f64c247..d778e89 100644
@@ -2149,7 +2149,7 @@
 static LSTATUS
 GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size)
 {
-    if (domains == NULL || size == 0)
+    if (domains == NULL || size == NULL || *size == 0)
     {
         return ERROR_INVALID_PARAMETER;
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1389?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: I8b26c65415f5a751f416d80a22cbb7ff14aa27c0
Gerrit-Change-Number: 1389
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

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

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

Change subject: iservice: make sure buffer size is not zero
......................................................................

iservice: make sure buffer size is not zero

GetItfDnsDomains expects a non-zero size buffer to return the domains in. Check for the size as well, not just for a valid pointer.

Change-Id I8b26c65415f5a751f416d80a22cbb7ff14aa27c0

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

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpnserv/interactive.c +1 -1
index f64c247..d778e89 100644
@@ -2149,7 +2149,7 @@
 static LSTATUS
 GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size)
 {
-    if (domains == NULL || size == 0)
+    if (domains == NULL || size == NULL || *size == 0)
     {
         return ERROR_INVALID_PARAMETER;
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1389?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: I8b26c65415f5a751f416d80a22cbb7ff14aa27c0
Gerrit-Change-Number: 1389
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>