util: fix UB with ctype functions - tscrape - twitter scraper
(HTM) git clone git://git.codemadness.org/tscrape
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8ff19bed65e82fddf4c01543eaa536863b378fc2
(DIR) parent 1bd861708376c35e3b43e9e0720ff5248d3050d3
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
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(-)
---
(DIR) 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;
}