mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 17:31:46 -05:00
range: prevent negative end number in a glob range
CVE-2016-8620 Bug: https://curl.haxx.se/docs/adv_20161102F.html Reported-by: Luật Nguyễn
This commit is contained in:
parent
96a80b5a26
commit
fbb5f1aa03
@ -257,6 +257,12 @@ static CURLcode glob_range(URLGlob *glob, char **patternp,
|
||||
endp = NULL;
|
||||
else {
|
||||
pattern = endp+1;
|
||||
while(*pattern && ISBLANK(*pattern))
|
||||
pattern++;
|
||||
if(!ISDIGIT(*pattern)) {
|
||||
endp = NULL;
|
||||
goto fail;
|
||||
}
|
||||
errno = 0;
|
||||
max_n = strtoul(pattern, &endp, 10);
|
||||
if(errno || (*endp == ':')) {
|
||||
@ -277,6 +283,7 @@ static CURLcode glob_range(URLGlob *glob, char **patternp,
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
*posp += (pattern - *patternp);
|
||||
|
||||
if(!endp || (min_n > max_n) || (step_n > (max_n - min_n)) || !step_n)
|
||||
|
Loading…
x
Reference in New Issue
Block a user