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/setup.h | |
parent | 930f9bd5342e6d514f9ba5b1303762c100621965 (diff) |
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/setup.h')
-rw-r--r-- | src/setup.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/setup.h b/src/setup.h index 1acd19e85..a8f636974 100644 --- a/src/setup.h +++ b/src/setup.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -184,4 +184,16 @@ int fileno( FILE *stream); #define strdup(ptr) curlx_strdup(ptr) #endif +#ifndef ISSPACE +/* typecasting craze to avoid negative number inputs to these macros */ +/* copied from lib/setup.h */ +#define ISSPACE(x) (isspace((int)((unsigned char)x))) +#define ISDIGIT(x) (isdigit((int)((unsigned char)x))) +#define ISALNUM(x) (isalnum((int)((unsigned char)x))) +#define ISXDIGIT(x) (isxdigit((int)((unsigned char)x))) +#define ISGRAPH(x) (isgraph((int)((unsigned char)x))) +#define ISALPHA(x) (isalpha((int)((unsigned char)x))) +#define ISPRINT(x) (isprint((int)((unsigned char)x))) +#endif + #endif /* __SRC_CURL_SETUP_H */ |