Skip to content

Commit 584d012

Browse files
committed
tool_urlglob: fix off-by-one error in glob_parse()
... causing SIGSEGV while parsing URL with too many globs. Minimal example: $ curl $(for i in $(seq 101); do printf '{a}'; done) Reported-by: Romain Coltel Bug: https://bugzilla.redhat.com/1340757
1 parent 873b434 commit 584d012

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

RELEASE-NOTES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This release includes the following bugfixes:
1919
o URL parser: allow URLs to use one, two or three slashes [6]
2020
o curl: fix -q [regression] [7]
2121
o openssl: Use correct buffer sizes for error messages [8]
22+
o curl: fix SIGSEGV while parsing URL with too many globs [9]
2223

2324
This release includes the following known bugs:
2425

@@ -43,3 +44,4 @@ References to bug reports and discussions on issues:
4344
[6] = https://curl.haxx.se/bug/?i=791
4445
[7] = https://curl.haxx.se/bug/?i=842
4546
[8] = https://curl.haxx.se/bug/?i=844
47+
[9] = https://bugzilla.redhat.com/1340757

src/tool_urlglob.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static CURLcode glob_parse(URLGlob *glob, char *pattern,
401401
}
402402
}
403403

404-
if(++glob->size > GLOB_PATTERN_NUM)
404+
if(++glob->size >= GLOB_PATTERN_NUM)
405405
return GLOBERROR("too many globs", pos, CURLE_URL_MALFORMAT);
406406
}
407407
return res;

0 commit comments

Comments
 (0)