Skip to content

Commit

Permalink
tool_urlglob: Improve sanity check in glob_range
Browse files Browse the repository at this point in the history
Prior to this change we depended on errno if strtol could not perform a
conversion. POSIX says EINVAL *may* be set. Some implementations like
Microsoft's will not set it if there's no conversion.

Ref: ee4f7660#commitcomment-19658189
  • Loading branch information
jay committed Nov 25, 2016
1 parent 4bda3e0 commit a6618b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tool_urlglob.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static CURLcode glob_range(URLGlob *glob, char **patternp,
unsigned long lstep;
errno = 0;
lstep = strtoul(&pattern[4], &endp, 10);
if(errno || (*endp != ']'))
if(errno || &pattern[4] == endp || *endp != ']')
step = -1;
else {
pattern = endp+1;
Expand Down

0 comments on commit a6618b5

Please sign in to comment.