From: Arne Schwabe Date: Thu, 15 Dec 2022 19:01:39 +0000 (+0100) Subject: Improve documentation on user/password requirement and unicodize function X-Git-Tag: v2.7_alpha1~638 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b6854881c36e16054878e0467ef87d925e20cae;p=thirdparty%2Fopenvpn.git Improve documentation on user/password requirement and unicodize function Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20221215190143.2107896-5-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25733.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h index 2a6c0b8b3..6a883f70a 100644 --- a/src/openvpn/misc.h +++ b/src/openvpn/misc.h @@ -67,6 +67,7 @@ struct user_pass #else #define USER_PASS_LEN 128 #endif + /* Note that username and password are expected to be null-terminated */ char username[USER_PASS_LEN]; char password[USER_PASS_LEN]; }; diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c index 72c13130a..20527d442 100644 --- a/src/openvpn/ntlm.c +++ b/src/openvpn/ntlm.c @@ -140,6 +140,19 @@ my_strupr(char *str) } } +/** + * This function expects a null-terminated string in src and will + * copy it (including the terminating NUL byte), + * alternating it with 0 to dst. + * + * This basically will transform a ASCII string into valid UTF-16. + * Characters that are 8bit in src, will get the same treatment, resulting in + * invalid or wrong unicode code points. + * + * @note the function will blindly assume that dst has double + * the space of src. + * @return the length of the number of bytes written to dst + */ static int unicodize(char *dst, const char *src) {