diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-08-31 17:39:51 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-08-31 17:39:51 +0000 |
commit | f170e5798fd7634a1be2c748464acb2ca485c9a3 (patch) | |
tree | 26153067b5e0ef42fca4ead32813c6b445006d75 /src/common | |
parent | bc0c39f85de6b55e431c13c85522abd2d2bccf7d (diff) | |
download | tor-f170e5798fd7634a1be2c748464acb2ca485c9a3.tar.gz tor-f170e5798fd7634a1be2c748464acb2ca485c9a3.zip |
r8692@Kushana: nickm | 2006-08-31 13:38:07 -0400
Fix bug 327 (part 2): Cast char to unsigned char before passing to toupper/tolower. (Follow the same idiom as with isupper and friends, in case we run into the same problem on SGI or whereever it was.)
svn:r8310
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/compat.h | 3 | ||||
-rw-r--r-- | src/common/container.c | 2 | ||||
-rw-r--r-- | src/common/util.c | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index a4f52040a0..f0757d577f 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -155,6 +155,9 @@ const void *tor_memmem(const void *haystack, size_t hlen, const void *needle, #define TOR_ISLOWER(c) islower((int)(unsigned char)(c)) #define TOR_ISUPPER(c) isupper((int)(unsigned char)(c)) +#define TOR_TOLOWER(c) ((char)tolower((int)(unsigned char)(c))) +#define TOR_TOUPPER(c) ((char)toupper((int)(unsigned char)(c))) + #ifdef MS_WINDOWS #define _SHORT_FILE_ (tor_fix_source_file(__FILE__)) const char *tor_fix_source_file(const char *fname); diff --git a/src/common/container.c b/src/common/container.c index 34ec1aa5e8..c5529058f3 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -824,7 +824,7 @@ strmap_remove_lc(strmap_t *map, const char *key) * iter = strmap_iter_next_rmv(iter); * free(val); * } else { - * for (;*cp;cp++) *cp = toupper(*cp); + * for (;*cp;cp++) *cp = TOR_TOUPPER(*cp); * iter = strmap_iter_next(iter); * } * } diff --git a/src/common/util.c b/src/common/util.c index e5fea55da6..f6fa063e82 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -308,7 +308,7 @@ void tor_strlower(char *s) { while (*s) { - *s = tolower(*s); + *s = TOR_TOLOWER(*s); ++s; } } @@ -319,7 +319,7 @@ void tor_strupper(char *s) { while (*s) { - *s = toupper(*s); + *s = TOR_TOUPPER(*s); ++s; } } |