curl: make #0 not output the full URL

It was not intended nor documented!

Added test 1176 to verify.

Reported-by: vshmuk on hackerone

Closes #4812
This commit is contained in:
Daniel Stenberg 2020-01-13 12:30:37 +01:00
parent 6773c7ca65
commit 4431ed2484
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 71 additions and 3 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -627,7 +627,7 @@ CURLcode glob_match_url(char **result, char *filename, URLGlob *glob)
unsigned long num = strtoul(&filename[1], &filename, 10);
URLPattern *pat = NULL;
if(num < glob->size) {
if(num && (num < glob->size)) {
unsigned long i;
num--; /* make it zero based */
/* find the correct glob entry */