diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-10-17 21:32:56 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-10-17 21:32:56 +0000 |
commit | 44d84ac1646cf04ccc2c1a736f3c9d1644ccacec (patch) | |
tree | 78c8960a291ba0a11548ab34e88a9a7b1bbcee3f /src/urlglob.c | |
parent | 930f9bd5342e6d514f9ba5b1303762c100621965 (diff) | |
download | curl-44d84ac1646cf04ccc2c1a736f3c9d1644ccacec.tar.gz |
Avoid typecasting a signed char to an int when using is*() functions, as that
could very well cause a negate number get passed in and thus cause reading
outside of the array usually used for this purpose.
We avoid this by using the uppercase macro versions introduced just now that
does some extra crazy typecasts to avoid byte codes > 127 to cause negative
int values.
Diffstat (limited to 'src/urlglob.c')
-rw-r--r-- | src/urlglob.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/urlglob.c b/src/urlglob.c index d5d3f4eae..ba4fb1eae 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -177,7 +177,7 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, /* patterns 0,1,2,... correspond to size=1,3,5,... */ ++glob->size; - if (isalpha((int)*pattern)) { /* character range detected */ + if (ISALPHA(*pattern)) { /* character range detected */ char min_c; char max_c; @@ -205,7 +205,7 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, pat->content.CharRange.ptr_c = pat->content.CharRange.min_c = min_c; pat->content.CharRange.max_c = max_c; } - else if (isdigit((int)*pattern)) { /* numeric range detected */ + else if (ISDIGIT(*pattern)) { /* numeric range detected */ int min_n; int max_n; @@ -229,9 +229,11 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, if (*pattern == '0') { /* leading zero specified */ c = pattern; - while (isdigit((int)*c++)) + while (ISDIGIT(*c)) { + c++; ++pat->content.NumRange.padlength; /* padding length is set for all instances of this pattern */ + } } } @@ -498,7 +500,7 @@ char *glob_match_url(char *filename, URLGlob *glob) return NULL; /* major failure */ while (*filename) { - if (*filename == '#' && isdigit((int)filename[1])) { + if (*filename == '#' && ISDIGIT(filename[1])) { unsigned long i; char *ptr = filename; unsigned long num = strtoul(&filename[1], &filename, 10); |