diff options
author | David Shaw <[email protected]> | 2003-07-10 12:26:42 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-07-10 12:26:42 +0000 |
commit | 654276143b4096f630cffb2010a08a60bd01c6b8 (patch) | |
tree | 5aa42063fd4299385ab70740580438c5049469d9 /util/strgutil.c | |
parent | * types.h: Prefer using uint64_t when creating a 64-bit unsigned type. (diff) | |
download | gnupg-654276143b4096f630cffb2010a08a60bd01c6b8.tar.gz gnupg-654276143b4096f630cffb2010a08a60bd01c6b8.zip |
* iobuf.c (check_special_filename): Replaced is isdigit by digitp
to avoid passing negative values and potential locale problems.
Problem noted by Christian Biere.
* strgutil.c (strlwr,strcasecmp,strncasecmp): Make sure we don't
pass a negative value.
* miscutil.c (scan_isodatestr): Ditto.
Diffstat (limited to 'util/strgutil.c')
-rw-r--r-- | util/strgutil.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/util/strgutil.c b/util/strgutil.c index e793fc1ce..05524d84d 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -1,5 +1,6 @@ /* strgutil.c - string utilities - * Copyright (C) 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1994, 1998, 1999, 2000, 2001, + * 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -825,7 +826,7 @@ strlwr(char *s) { char *p; for(p=s; *p; p++ ) - *p = tolower(*p); + *p = tolower(*(unsigned char *)p); return s; } #endif @@ -835,7 +836,8 @@ int strcasecmp( const char *a, const char *b ) { for( ; *a && *b; a++, b++ ) { - if( *a != *b && toupper(*a) != toupper(*b) ) + if( *a != *b + && toupper(*(const byte *)a) != toupper(*(const byte *)b) ) break; } return *(const byte*)a - *(const byte*)b; @@ -847,7 +849,8 @@ int strncasecmp( const char *a, const char *b, size_t n ) { for( ; n && *a && *b; a++, b++, n--) { - if( *a != *b && toupper(*a) != toupper(*b) ) + if( *a != *b + && toupper(*(const byte *)a) != toupper(*(const byte *)b) ) break; } if (!n) |