util: fix UB with ctype functions - tscrape - twitter scraper | |
git clone git://git.codemadness.org/tscrape | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8ff19bed65e82fddf4c01543eaa536863b378fc2 | |
parent 1bd861708376c35e3b43e9e0720ff5248d3050d3 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Fri, 7 Sep 2018 19:36:50 +0200 | |
util: fix UB with ctype functions | |
Diffstat: | |
M util.c | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/util.c b/util.c | |
@@ -111,13 +111,13 @@ printescape(const char *s) | |
const char *e; | |
/* strip leading and trailing white-space */ | |
- for (; *s && isspace(*s); s++) | |
+ for (; *s && isspace((unsigned char)*s); s++) | |
; | |
- for (e = s + strlen(s); e > s && isspace(*(e - 1)); e--) | |
+ for (e = s + strlen(s); e > s && isspace((unsigned char)*(e - 1)); e--) | |
; | |
for (i = 0; *s && s < e; s++) { | |
- if (iscntrl(*s) || isspace(*s)) { | |
+ if (iscntrl((unsigned char)*s) || isspace((unsigned char)*s)) { | |
i++; | |
continue; | |
} |