]> git.feebdaed.xyz Git - 0xmirror/openvpn.git/commitdiff
iservice: handle ignoring itf domains correctly
authorHeiko Hund <heiko@ist.eigentlich.net>
Wed, 26 Nov 2025 10:47:01 +0000 (11:47 +0100)
committerGert Doering <gert@greenie.muc.de>
Wed, 26 Nov 2025 11:07:01 +0000 (12:07 +0100)
GetItfDnsDomains() does ignore domains, which are in the search domains
list. Handling of this was done wrong if there was more than one
interface domain. In any case the size returned to the caller was
calculated wrong.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: I02e2c7b27b5a39b11556e4753c648baa05344ffc
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1394
Message-Id: <20251126104706.5378-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34677.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpnserv/interactive.c

index 4a3e689b437b255f97d42b6f51f7a0266b79d12a..ce37ac2f2a4abc24d5ba88cfd3a09899fa1797db 100644 (file)
@@ -2190,14 +2190,16 @@ GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size)
                 {
                     if (comma)
                     {
-                        pos = comma + 1;
+                        /* Overwrite the ignored domain with remaining one(s) */
+                        memmove(pos, comma + 1, buf_size - converted_size);
+                        *size -= domain_size + one_glyph;
                         continue;
                     }
                     else
                     {
                         /* This was the last domain */
                         *pos = '\0';
-                        *size += one_glyph;
+                        *size -= domain_size;
                         return wcslen(domains) ? NO_ERROR : ERROR_FILE_NOT_FOUND;
                     }
                 }