aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog13
-rw-r--r--util/iobuf.c2
-rw-r--r--util/miscutil.c8
-rw-r--r--util/strgutil.c11
4 files changed, 22 insertions, 12 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 76364a6ec..d676f2f57 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-07 Werner Koch <[email protected]>
+
+ * 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.
+
2003-05-21 David Shaw <[email protected]>
* argparse.c, dotlock.c, fileutil.c, iobuf.c, miscutil.c,
@@ -1034,7 +1043,7 @@ Fri Feb 13 15:14:13 1998 Werner Koch ([email protected])
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
@@ -1043,5 +1052,3 @@ Fri Feb 13 15:14:13 1998 Werner Koch ([email protected])
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-
diff --git a/util/iobuf.c b/util/iobuf.c
index 7ce1aa529..723255e62 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -1032,7 +1032,7 @@ check_special_filename ( const char *fname )
int i;
fname += 2;
- for (i=0; isdigit (fname[i]); i++ )
+ for (i=0; digitp (fname+i); i++ )
;
if ( !fname[i] )
return atoi (fname);
diff --git a/util/miscutil.c b/util/miscutil.c
index 42b2b3a88..b266d27d4 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -1,5 +1,5 @@
/* miscutil.c - miscellaneous utilities
- * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -56,11 +56,11 @@ scan_isodatestr( const char *string )
if( strlen(string) != 10 || string[4] != '-' || string[7] != '-' )
return 0;
for( i=0; i < 4; i++ )
- if( !isdigit(string[i]) )
+ if( !digitp(string+i) )
return 0;
- if( !isdigit(string[5]) || !isdigit(string[6]) )
+ if( !digitp(string+5) || !digitp(string+6) )
return 0;
- if( !isdigit(string[8]) || !isdigit(string[9]) )
+ if( !digitp(string+8) || !digitp(string+9) )
return 0;
year = atoi(string);
month = atoi(string+5);
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)