summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2021-08-07 14:14:12 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2021-08-07 14:29:02 +0200
commit7899e1d17b6ff2182b0fa9afbe098038e7efc7e9 (patch)
treec26d252aaf52610aef3190cfba578872d438964b
parent254b2d3c7c5679275b40449f75fe263a27277d6b (diff)
downloadwget-7899e1d17b6ff2182b0fa9afbe098038e7efc7e9.tar.gz
* src/html-url.c (tag_handle_meta): Fix integer overflow
-rw-r--r--src/html-url.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/html-url.c b/src/html-url.c
index ed296bbc..cbb9e967 100644
--- a/src/html-url.c
+++ b/src/html-url.c
@@ -588,16 +588,16 @@ tag_handle_meta (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
struct urlpos *entry;
int attrind;
- int timeout = 0;
+ int timeout;
char *p;
char *refresh = find_attr (tag, "content", &attrind);
if (!refresh)
return;
- for (p = refresh; c_isdigit (*p); p++)
- timeout = 10 * timeout + *p - '0';
- if (*p++ != ';')
+ timeout = strtol(refresh, &p, 10);
+
+ if (timeout < 0 || *p++ != ';')
return;
while (c_isspace (*p))