summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2019-05-25 20:44:25 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-05-25 20:44:25 +0200
commitc18bb8bf4a78c62ebc032c1f30db38f78f550795 (patch)
tree9c31f5cc58b9ce7abe09b29507c7a29d737068fd
parent16a6611cab6de98d5128ae5c89704f156b6dd855 (diff)
gettzoffset: fix possible arithmetic overflow if int is 16-bit
also reduce size of return type (32-bit+ should be enough).
-rw-r--r--sfeed.c6
1 files 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++)