fix UB with ctype functions - sub - subscene.com subtitle search | |
git clone git://git.codemadness.org/sub | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f5a954fb9a5c3bf16b49bef56fa6208c60af949f | |
parent eeb5e64cda380f9c2ea9b706d5724b41c2e97a22 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Fri, 7 Sep 2018 19:39:07 +0200 | |
fix UB with ctype functions | |
Diffstat: | |
M sub.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/sub.c b/sub.c | |
@@ -55,7 +55,7 @@ xml_handler_data(XMLParser *p, const char *data, size_t datal… | |
return; | |
/* skip leading space */ | |
- for (s = (char *)data; *s && isspace(*s); s++) | |
+ for (s = (char *)data; *s && isspace((unsigned char)*s); s++) | |
; | |
strlcpy(buf, s, sizeof(buf)); | |
for (s = buf; *s; s++) { | |
@@ -65,7 +65,7 @@ xml_handler_data(XMLParser *p, const char *data, size_t datal… | |
/* trim remaining space */ | |
len = strlen(buf); | |
for (; len > 0; len--) { | |
- if (!isspace(buf[len - 1])) | |
+ if (!isspace((unsigned char)buf[len - 1])) | |
break; | |
buf[len - 1] = '\0'; | |
} |