From: Guido Vranken Date: Wed, 7 Jun 2017 22:44:15 +0000 (+0200) Subject: refactor my_strupr X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23d632de5d5a99914c90d3b4842e426802347e77;p=thirdparty%2Fopenvpn.git refactor my_strupr Refactor my_strupr such that it will not check and possibly alter bytes after the string's null terminator for strings of length 0. Signed-off-by: Guido Vranken Acked-by: Gert Doering Message-Id: URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14756.html Signed-off-by: Gert Doering (cherry picked from commit 69162924de3600bfe8ae9708a1d6e3f4515ef995) (cherry picked from commit 8dd598e89f25074f2d4d23f77cb601cf48a810e3) --- diff --git a/ntlm.c b/ntlm.c index 0453358cc..5c3d6d6ad 100644 --- a/ntlm.c +++ b/ntlm.c @@ -127,13 +127,16 @@ gen_nonce (unsigned char *nonce) } } -unsigned char *my_strupr(unsigned char *str) -{ - /* converts string to uppercase in place */ - unsigned char *tmp = str;; +void +my_strupr(unsigned char *str) +{ + /* converts string to uppercase in place */ - do *str = toupper(*str); while (*(++str)); - return tmp; + while (*str) + { + *str = toupper(*str); + str++; + } } static int