]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
refactor my_strupr
authorGuido Vranken <guidovranken@gmail.com>
Wed, 7 Jun 2017 22:44:15 +0000 (00:44 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 8 Jun 2017 19:09:48 +0000 (21:09 +0200)
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 <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-ELXwXgGtRFou=FY1TAhW4W4BHPZF4=rqSY877njtXNMJg@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14756.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 69162924de3600bfe8ae9708a1d6e3f4515ef995)

src/openvpn/ntlm.c

index 3390bdddfe0b022b4726909042eed13eba992bc6..ac66a2fac14ae2ed5343bd18310b869d5ad7220c 100644 (file)
@@ -130,13 +130,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