curl segfaults when network is down and --retry option is used

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6.4
  • curl-7.19.7-37.el6_4.x86_64

Issue

When downloading with curl a segmentation fault sometimes occur. Crash occurred when following command was issued:

curl -l --max-time 10 --retry 3 "ftp://example.com/example{1,2}" -o "/tmp/tmpfile.#1"

and network outage was observed.

Resolution

Please, update curl to version curl-7.19.7-46.el6 released with Errata RHSA-2015:1254-3 or newer.

Root Cause

When getting multiple URLs, curl didn't properly reset the byte counter
after a successful transfer so if the subsequent transfer failed it
would wrongly use the previous byte counter and behave badly (segfault)
because of that. Now, adding --retry no longer causes curl to crash.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments