]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Improve documentation on user/password requirement and unicodize function
authorArne Schwabe <arne@rfc2549.org>
Thu, 15 Dec 2022 19:01:39 +0000 (20:01 +0100)
committerGert Doering <gert@greenie.muc.de>
Fri, 16 Dec 2022 17:07:40 +0000 (18:07 +0100)
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>
(cherry picked from commit 4b6854881c36e16054878e0467ef87d925e20cae)

src/openvpn/misc.h
src/openvpn/ntlm.c

index 570e473b28a4f156df1c1802d2abc64bd837e02e..1e5205671add5d5fef161d1216c1449fb2beb6fd 100644 (file)
@@ -74,6 +74,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];
 };
index e3707484d593801945a1dc51e75401a25c38f67b..9158cfd67297717b1b8f771a81bce1fcb007fbe7 100644 (file)
@@ -143,6 +143,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)
 {