cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] curl tool: allow negative numbers as option values

From: Alessandro Ghedini <al3xbio_at_gmail.com>
Date: Sun, 12 Feb 2012 15:40:48 +0100

Hi all,

from the --max-redirs description in the man page:

    "Set this option to -1 to make it limitless."

but if --max-redirs get set to -1, curl hangs:

    curl: option --max-redirs: expected a proper numerical parameter

The attached patch removes the check inside str2num() that makes it accept
only strings that start with a digit, which is wrong since strtol() supports
numbers prepended with '-' and '+' too (or spaces FWIW). Also, one can input
e.g. '0lol' and pass the check; IMO the non-NULL check is enough.

This is Debian bug #659591 [0].

Cheers

[0] http://bugs.debian.org/659591

-- 
perl -E'$_=q;$/= @{[@_]};and s;\S+;<inidehG ordnasselA>;eg;say~~reverse'
Received on 2012-02-12