From c18bb8bf4a78c62ebc032c1f30db38f78f550795 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 25 May 2019 20:44:25 +0200 Subject: gettzoffset: fix possible arithmetic overflow if int is 16-bit also reduce size of return type (32-bit+ should be enough). --- sfeed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sfeed.c b/sfeed.c index 7701237..fee47ce 100644 --- a/sfeed.c +++ b/sfeed.c @@ -91,7 +91,7 @@ typedef struct feedcontext { static long long datetounix(long long, int, int, int, int, int); static enum TagId gettag(enum FeedType, const char *, size_t); -static long long gettzoffset(const char *); +static long gettzoffset(const char *); static int isattr(const char *, size_t, const char *, size_t); static int istag(const char *, size_t, const char *, size_t); static int parsetime(const char *, time_t *); @@ -410,7 +410,7 @@ datetounix(long long year, int mon, int day, int hour, int min, int sec) * ambiguous anyway. * ANSI and military zones are defined wrong in RFC822 and are unsupported, * see note on RFC2822 4.3 page 32. */ -static long long +static long gettzoffset(const char *s) { static struct { @@ -427,7 +427,7 @@ gettzoffset(const char *s) { "PST", -8 * 3600 }, }; const char *p; - int tzhour = 0, tzmin = 0; + long tzhour = 0, tzmin = 0; size_t i; for (; *s && isspace((unsigned char)*s); s++) -- cgit v1.2.3