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 1bd861708376c35e3b43e9e0720ff5248d3050d3
(DIR) parent aec6f674a5888e14a217ae1944ca2d3d0e790a6a
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 7 Sep 2018 19:35:38 +0200
fix UB with ctype functions
Diffstat:
M tscrape.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/tscrape.c b/tscrape.c
@@ -74,7 +74,8 @@ isclassmatch(const char *classes, const char *clss, size_t len)
if (!(p = strstr(classes, clss)))
return 0;
- return (p == classes || isspace(p[-1])) && (isspace(p[len]) || !p[len]);
+ return (p == classes || isspace((unsigned char)p[-1])) &&
+ (isspace((unsigned char)p[len]) || !p[len]);
}
/* convert XML and some HTML entities */
@@ -161,7 +162,7 @@ xmltagstartparsed(XMLParser *x, const char *t, size_t tl, int isshort)
datatime[0] = '\0';
}
}
- if ((state & Text) && !strcmp(t, "a") && !isspace(text[0]))
+ if ((state & Text) && !strcmp(t, "a") && !isspace((unsigned char)text[0]))
strlcat(text, " ", sizeof(text));
}