mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibC: Don't let ctype isfoo() helpers access array out of bounds
This commit is contained in:
parent
35875b68f5
commit
b3f6b43d3c
Notes:
sideshowbarker
2024-07-19 06:33:24 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b3f6b43d3c4
1 changed files with 11 additions and 11 deletions
|
@ -57,17 +57,17 @@ int isgraph(int);
|
||||||
int islower(int);
|
int islower(int);
|
||||||
int isupper(int);
|
int isupper(int);
|
||||||
|
|
||||||
#define isalnum(c) (_ctype_[(int)(c)] & (_U | _L | _N))
|
#define isalnum(c) (_ctype_[(unsigned char)(c)] & (_U | _L | _N))
|
||||||
#define isalpha(c) (_ctype_[(int)(c)] & (_U | _L))
|
#define isalpha(c) (_ctype_[(unsigned char)(c)] & (_U | _L))
|
||||||
#define iscntrl(c) (_ctype_[(int)(c)] & (_C))
|
#define iscntrl(c) (_ctype_[(unsigned char)(c)] & (_C))
|
||||||
#define isdigit(c) (_ctype_[(int)(c)] & (_N))
|
#define isdigit(c) (_ctype_[(unsigned char)(c)] & (_N))
|
||||||
#define isxdigit(c) (_ctype_[(int)(c)] & (_N | _X))
|
#define isxdigit(c) (_ctype_[(unsigned char)(c)] & (_N | _X))
|
||||||
#define isspace(c) (_ctype_[(int)(c)] & (_S))
|
#define isspace(c) (_ctype_[(unsigned char)(c)] & (_S))
|
||||||
#define ispunct(c) (_ctype_[(int)(c)] & (_P))
|
#define ispunct(c) (_ctype_[(unsigned char)(c)] & (_P))
|
||||||
#define isprint(c) (_ctype_[(int)(c)] & (_P | _U | _L | _N | _B))
|
#define isprint(c) (_ctype_[(unsigned char)(c)] & (_P | _U | _L | _N | _B))
|
||||||
#define isgraph(c) (_ctype_[(int)(c)] & (_P | _U | _L | _N))
|
#define isgraph(c) (_ctype_[(unsigned char)(c)] & (_P | _U | _L | _N))
|
||||||
#define islower(c) ((_ctype_[(int)(c)] & (_U | _L)) == _L)
|
#define islower(c) ((_ctype_[(unsigned char)(c)] & (_U | _L)) == _L)
|
||||||
#define isupper(c) ((_ctype_[(int)(c)] & (_U | _L)) == _U)
|
#define isupper(c) ((_ctype_[(unsigned char)(c)] & (_U | _L)) == _U)
|
||||||
|
|
||||||
#define isascii(c) ((unsigned)c <= 127)
|
#define isascii(c) ((unsigned)c <= 127)
|
||||||
#define toascii(c) ((c)&127)
|
#define toascii(c) ((c)&127)
|
||||||
|
|
Loading…
Reference in a new issue