fix UB with ctype functions - tscrape - twitter scraper | |
git clone git://git.codemadness.org/tscrape | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1bd861708376c35e3b43e9e0720ff5248d3050d3 | |
parent aec6f674a5888e14a217ae1944ca2d3d0e790a6a | |
Author: Hiltjo Posthuma <[email protected]> | |
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(-) | |
--- | |
diff --git a/tscrape.c b/tscrape.c | |
@@ -74,7 +74,8 @@ isclassmatch(const char *classes, const char *clss, size_t le… | |
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, i… | |
datatime[0] = '\0'; | |
} | |
} | |
- if ((state & Text) && !strcmp(t, "a") && !isspace(text[0])) | |
+ if ((state & Text) && !strcmp(t, "a") && !isspace((unsigned char)text[… | |
strlcat(text, " ", sizeof(text)); | |
} | |