hurl

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c197d88840a5544997be532a8caad6875c95abc8
parent 049d30214771c86b673413086eee4c541a01cf5a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 17 Nov 2018 11:50:05 +0100

check maxfilesize and timeout more strictly, use signed type

Diffstat:
Mhurl.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hurl.c b/hurl.c @@ -462,6 +462,7 @@ main(int argc, char **argv) { char *end; int statuscode; + long long l; ARGBEGIN { case 'H': /* custom HTTP headers */ @@ -469,15 +470,17 @@ main(int argc, char **argv) break; case 'm': /* max filesize */ errno = 0; - config_maxresponsesiz = strtoll(EARGF(usage()), &end, 10); - if (errno || *end != '\0' || config_maxresponsesiz < 0) + l = strtoll(EARGF(usage()), &end, 10); + if (errno || *end != '\0' || l < 0) usage(); + config_maxresponsesiz = l; break; case 't': /* timeout */ errno = 0; - config_timeout = strtoll(EARGF(usage()), &end, 10); - if (errno || *end != '\0' || config_timeout < 0) + l = strtoll(EARGF(usage()), &end, 10); + if (errno || *end != '\0' || l < 0) usage(); + config_timeout = l; break; default: usage();