Go to file
Jay Satiro 4015fae044
connection_check: restore original conn->data after the check
- Save the original conn->data before it's changed to the specified
  data transfer for the connection check and then restore it afterwards.

This is a follow-up to 38d8e1b 2019-02-11.

History:

It was discovered a month ago that before checking whether to extract a
dead connection that that connection should be associated with a "live"
transfer for the check (ie original conn->data ignored and set to the
passed in data). A fix was landed in 54b201b which did that and also
cleared conn->data after the check. The original conn->data was not
restored, so presumably it was thought that a valid conn->data was no
longer needed.

Several days later it was discovered that a valid conn->data was needed
after the check and follow-up fix was landed in bbae24c which partially
reverted the original fix and attempted to limit the scope of when
conn->data was changed to only when pruning dead connections. In that
case conn->data was not cleared and the original conn->data not
restored.

A month later it was discovered that the original fix was somewhat
correct; a "live" transfer is needed for the check in all cases
because original conn->data could be null which could cause a bad deref
at arbitrary points in the check. A fix was landed in 38d8e1b which
expanded the scope to all cases. conn->data was not cleared and the
original conn->data not restored.

A day later it was discovered that not restoring the original conn->data
may lead to busy loops in applications that use the event interface, and
given this observation it's a pretty safe assumption that there is some
code path that still needs the original conn->data. This commit is the
follow-up fix for that, it restores the original conn->data after the
connection check.

Assisted-by: tholin@users.noreply.github.com
Reported-by: tholin@users.noreply.github.com

Fixes https://github.com/curl/curl/issues/3542
Closes #3559
2019-02-14 17:42:43 +01:00
.github
CMake cmake: updated check for HAVE_POLL_FINE to match autotools 2019-01-16 11:39:34 +03:00
docs KNOWN_BUGS: Cannot compile against a static build of OpenLDAP 2019-02-14 15:36:43 +01:00
include curlver: bump to 7.64.1-dev 2019-02-11 18:15:13 +01:00
lib connection_check: restore original conn->data after the check 2019-02-14 17:42:43 +01:00
m4 configure: rewrite --enable-code-coverage 2019-01-26 00:29:50 +01:00
packages os400: add a missing closing bracket 2019-01-10 12:04:35 +01:00
projects VS projects: fix build warning 2019-01-06 23:16:05 +01:00
scripts scripts/singleuse: script to use to track single-use functions 2019-02-11 08:55:47 +01:00
src curl: "Dereference of null pointer" 2019-02-13 18:44:17 +01:00
tests gssapi: fix deprecated header warnings 2019-02-14 08:38:43 +01:00
winbuild winbuild: conditionally use /DZLIB_WINAPI 2019-01-14 10:14:06 +01:00
.cirrus.yml cirrus: Added FreeBSD builds using Cirrus CI. 2019-02-10 16:00:25 +01:00
.dir-locals.el
.gitattributes .gitattributes: make tabs in indentation a visible error 2018-12-06 20:21:17 +01:00
.gitignore checksrc: add COPYRIGHTYEAR check 2018-12-03 23:13:40 +01:00
.lgtm.yml
.mailmap URL and mailmap updates, remove an obsolete directory [ci skip] 2018-09-22 07:58:32 +00:00
.travis-iconv-env.sh
.travis.yml travis: added cmake build for osx 2019-01-15 07:11:56 +03:00
acinclude.m4 configure: fix recv/send/select detection on Android 2019-01-19 20:24:00 +01:00
appveyor.yml AppVeyor: remove BDIR variable that sneaked in again 2018-10-10 21:57:42 +02:00
buildconf
buildconf.bat whitespace fixes 2018-09-23 22:24:02 +00:00
CHANGES
CMakeLists.txt cmake: updated check for HAVE_POLL_FINE to match autotools 2019-01-16 11:39:34 +03:00
configure.ac configure: show features as well in the final summary 2019-02-14 12:59:44 +01:00
COPYING COPYING: it's 2019 2019-01-19 20:26:31 +01:00
curl-config.in curl-config.in: remove dependency on bc 2018-10-26 00:06:19 +02:00
GIT-INFO
libcurl.pc.in
MacOSX-Framework
Makefile.am Makefile: add 'tidy' target that runs clang-tidy 2018-10-27 15:59:38 +02:00
Makefile.dist
maketgz maketgz: delete .bak files, fix indentation 2018-06-15 23:28:34 +00:00
README
README.md cirrus: Added FreeBSD builds using Cirrus CI. 2019-02-10 16:00:25 +01:00
RELEASE-NOTES RELEASE-NOTES: synced 2019-02-11 18:10:53 +01:00

curl logo

CII Best Practices Coverity passed Travis-CI Build Status AppVeyor Build Status Cirrus Build Status Coverage Status Backers on Open Collective Sponsors on Open Collective Language Grade: C/C++ Codacy Badge

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

You find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms and similar. If you distribute curl binaries or other binaries that involve libcurl, you might enjoy the LICENSE-MIXING document.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Website

Visit the curl web site for the latest news and downloads.

Git

To download the very latest source from the Git server do this:

git clone https://github.com/curl/curl.git

(you'll get a directory named curl created, filled with the source code)

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]