sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit c18bb8bf4a78c62ebc032c1f30db38f78f550795
parent 16a6611cab6de98d5128ae5c89704f156b6dd855
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 25 May 2019 20:44:25 +0200

gettzoffset: fix possible arithmetic overflow if int is 16-bit

also reduce size of return type (32-bit+ should be enough).

Diffstat:
Msfeed.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 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++)