Message ID | 20221215190143.2107896-5-arne@rfc2549.org |
---|---|
State | Accepted |
Headers | show |
Series | Improvement/fixes based on Trail of Bits audit | expand |
Acked-by: Gert Doering <gert@greenie.muc.de> Haven't tested anything :-) - but the documentation addition is useful. Your patch has been applied to the master, release/2.6 and release/2.5 branch. commit 4b6854881c36e16054878e0467ef87d925e20cae (master) commit d327476c35a3fe366c1d9155ccf24172c59bb60d (release/2.6) commit fad810fff33946e1b79d408e97ea8b7c017e9fb4 (release/2.5) Author: Arne Schwabe Date: Thu Dec 15 20:01:39 2022 +0100 Improve documentation on user/password requirement and unicodize function Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> 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 <gert@greenie.muc.de> -- kind regards, 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) {
Signed-off-by: Arne Schwabe <arne@rfc2549.org> --- src/openvpn/misc.h | 1 + src/openvpn/ntlm.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)