Attention is currently required from: cron2, plaisthos.

Hello cron2, plaisthos,

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

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

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

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


Change subject: iservice: fix calculation of converted domains size
......................................................................

iservice: fix calculation of converted domains size

To keep track of how much of the buffer is already used, the difference
of the current position and the start of the buffer needs to be
multiplied with the size of a character / glyph to bet the byte count,
with which calculations are done further down below.

Reported-by: Marc Heuse <[email protected]>
Reported-by: [email protected]
Change-Id: I16f9426e57f4802ba038ab51f5b70161464b9428
Signed-off-by: Heiko Hund <[email protected]>
---
M src/openvpnserv/interactive.c
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1390/2

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 07ca7c9..9c533c1 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -2181,8 +2181,11 @@
                     *comma = '\0';
                 }

-                /* Ignore itf domains which match a pushed search domain */
                 size_t domain_len = wcslen(pos);
+                size_t domain_size = domain_len * one_glyph;
+                size_t converted_size = (pos - domains) * one_glyph;
+
+                /* Ignore itf domains which match a pushed search domain */
                 if (ListContainsDomain(search_domains, pos, domain_len))
                 {
                     if (comma)
@@ -2199,11 +2202,14 @@
                     }
                 }

-                /* Check for enough space to convert this domain */
-                domain_len += 1; /* leading dot */
-                size_t converted_size = pos - domains;
-                size_t domain_size = domain_len * one_glyph;
+                /* Add space for the leading dot */
+                domain_len += 1;
+                domain_size += one_glyph;
+
+                /* Space for the terminating zeros */
                 size_t extra_size = 2 * one_glyph;
+
+                /* Check for enough space to convert this domain */
                 if (converted_size + domain_size + extra_size > buf_size)
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1390?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: I16f9426e57f4802ba038ab51f5b70161464b9428
Gerrit-Change-Number: 1390
Gerrit-PatchSet: 2
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: cron2 <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to