mirror of
https://github.com/curl/curl.git
synced 2026-08-25 08:13:31 +03:00
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.
This commit is contained in:
parent
930f9bd534
commit
44d84ac164
17 changed files with 81 additions and 59 deletions
10
lib/setup.h
10
lib/setup.h
|
|
@ -348,6 +348,16 @@ int fileno( FILE *stream);
|
|||
#define DEBUGF(x)
|
||||
#endif
|
||||
|
||||
#ifndef ISSPACE
|
||||
/* typecasting craze to avoid negative number inputs to these macros */
|
||||
#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)))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include macros and defines that should only be processed once.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue