summaryrefslogtreecommitdiff
path: root/sfeed_html.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2014-06-28 15:38:48 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2014-06-28 15:38:48 +0200
commit97a069df32404705b9c5782cae338a0ea39f4535 (patch)
tree3e7a28980945bdf27a3312b8223af321ae262d6e /sfeed_html.c
parentaf2d105e1e48c593e3536fecbd251671f81ccf9c (diff)
handle invalid values of strto*l
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat (limited to 'sfeed_html.c')
-rw-r--r--sfeed_html.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sfeed_html.c b/sfeed_html.c
index afd3e4c..8ba798b 100644
--- a/sfeed_html.c
+++ b/sfeed_html.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
+#include <errno.h>
#include "util.h"
@@ -50,7 +51,10 @@ main(void) {
feeds = fcur;
while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) {
+ errno = 0;
parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10);
+ if(errno != 0)
+ parsedtime = 0;
isnew = (parsedtime >= comparetime) ? 1 : 0;
islink = (fields[FieldLink][0] != '\0') ? 1 : 0;
/* first of feed section or new feed section. */