From afbb7d7795395b842ee91bb837b72d495077fafb Mon Sep 17 00:00:00 2001 From: Leonardo Taccari Date: Fri, 7 Sep 2018 15:01:36 +0200 Subject: [PATCH 2/2] sfeed: Cast argument to (unsigned char) in isXXX(...) ctype functions This avoid possible undefined behaviours. --- sfeed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sfeed.c b/sfeed.c index 4c51966..4fa054c 100644 --- a/sfeed.c +++ b/sfeed.c @@ -381,11 +381,11 @@ gettzoffset(const char *s) switch (s[0]) { case '-': /* offset */ case '+': - for (i = 0, p = s + 1; i < 2 && *p && isdigit(*p); i++, p++) + for (i = 0, p = s + 1; i < 2 && *p && isdigit((unsigned char)*p); i++, p++) tzhour = (tzhour * 10) + (*p - '0'); - if (*p && !isdigit(*p)) + if (*p && !isdigit((unsigned char)*p)) p++; - for (i = 0; i < 2 && *p && isdigit(*p); i++, p++) + for (i = 0; i < 2 && *p && isdigit((unsigned char)*p); i++, p++) tzmin = (tzmin * 10) + (*p - '0'); return ((tzhour * 3600) + (tzmin * 60)) * (s[0] == '-' ? -1 : 1); default: /* timezone name */ -- 2.18.0