From: Heiko Hund Date: Wed, 26 Nov 2025 10:43:07 +0000 (+0100) Subject: iservice: return correct size when domains are truncated X-Git-Tag: v2.7_rc3~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aeda359efaeae3d2d77f7a89223fa1b5bcac2c90;p=thirdparty%2Fopenvpn.git iservice: return correct size when domains are truncated In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ. Reported-by: Marc Heuse Reported-by: stephan@srlabs.de Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d Signed-off-by: Heiko Hund Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391 Message-Id: <20251126104315.4776-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34680.html Signed-off-by: Gert Doering --- diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index ed3c92891..4a3e689b4 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2214,7 +2214,7 @@ GetItfDnsDomains(HKEY itf, PCWSTR search_domains, PWSTR domains, PDWORD size) { /* Domain doesn't fit, bad luck if it's the first one */ *pos = '\0'; - *size = converted_size == 0 ? 0 : *size + 1; + *size = converted_size == 0 ? 0 : converted_size + one_glyph; return ERROR_MORE_DATA; }