Introduction
Introduction Statistics Contact Development Disclaimer Help
check range of max response size and max timeout parameters - hurl - Gopher/HTT…
git clone git://git.codemadness.org/hurl
Log
Files
Refs
README
LICENSE
---
commit 7f1f2eb85f5716b6a5632bcefc0c4c0cbb9a515e
parent 49f3642c3fa644bc376ad67e33a8f686c72c7e06
Author: Hiltjo Posthuma <[email protected]>
Date: Fri, 16 Nov 2018 16:05:45 +0100
check range of max response size and max timeout parameters
let setsockopt handle the max range of timeout.
Diffstat:
M hurl.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/hurl.c b/hurl.c
@@ -460,6 +460,7 @@ usage(void)
int
main(int argc, char **argv)
{
+ char *end;
int statuscode;
ARGBEGIN {
@@ -467,12 +468,16 @@ main(int argc, char **argv)
config_custom = EARGF(usage());
break;
case 'm': /* max filesize */
- /* TODO: strtonum */
- config_maxresponsesiz = atoll(EARGF(usage()));
+ errno = 0;
+ config_maxresponsesiz = strtoll(EARGF(usage()), &end, 10);
+ if (errno || *end != '\0' || config_maxresponsesiz < 0)
+ usage();
break;
case 't': /* timeout */
- /* TODO: strtonum */
- config_timeout = atoll(EARGF(usage()));
+ errno = 0;
+ config_timeout = strtoll(EARGF(usage()), &end, 10);
+ if (errno || *end != '\0' || config_timeout < 0)
+ usage();
break;
default:
usage();
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.