From 69f00d8ce6862772919e2714adb72f13f3e92ca7 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Thu, 8 Jun 2017 00:44:15 +0200 Subject: [PATCH] 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) --- src/openvpn/ntlm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c index 0c436812e..93483379b 100644 --- a/src/openvpn/ntlm.c +++ b/src/openvpn/ntlm.c @@ -130,17 +130,16 @@ gen_nonce(unsigned char *nonce) } } -unsigned char * +void my_strupr(unsigned char *str) { /* converts string to uppercase in place */ - unsigned char *tmp = str; - do + while (*str) { *str = toupper(*str); - } while (*(++str)); - return tmp; + str++; + } } static int -- 2.47.2