104-CVE-2017-1000101.patch 1015 B

123456789101112131415161718192021222324252627282930313233
  1. From 453e7a7a03a2cec749abd3878a48e728c515cca7 Mon Sep 17 00:00:00 2001
  2. From: Daniel Stenberg <daniel@haxx.se>
  3. Date: Tue, 1 Aug 2017 17:16:07 +0200
  4. Subject: [PATCH] glob: do not continue parsing after a strtoul() overflow
  5. range
  6. Added test 1289 to verify.
  7. CVE-2017-1000101
  8. Bug: https://curl.haxx.se/docs/adv_20170809A.html
  9. Reported-by: Brian Carpenter
  10. ---
  11. src/tool_urlglob.c | 5 ++++-
  12. tests/data/Makefile.inc | 2 +-
  13. tests/data/test1289 | 35 +++++++++++++++++++++++++++++++++++
  14. 3 files changed, 40 insertions(+), 2 deletions(-)
  15. create mode 100644 tests/data/test1289
  16. --- a/src/tool_urlglob.c
  17. +++ b/src/tool_urlglob.c
  18. @@ -272,7 +272,10 @@ static CURLcode glob_range(URLGlob *glob
  19. }
  20. errno = 0;
  21. max_n = strtoul(pattern, &endp, 10);
  22. - if(errno || (*endp == ':')) {
  23. + if(errno)
  24. + /* overflow */
  25. + endp = NULL;
  26. + else if(*endp == ':') {
  27. pattern = endp+1;
  28. errno = 0;
  29. step_n = strtoul(pattern, &endp, 10);