Skip to content

Commit

Permalink
- Jean-Francois Bertrand reported a libcurl crash with CURLOPT_TCP_NO…
Browse files Browse the repository at this point in the history
…DELAY

  since libcurl used getprotobyname() and that isn't thread-safe. We now
  switched to use IPPROTO_TCP unconditionally, but perhaps the proper fix is
  to detect the thread-safe version of the function and use that.
  http://curl.haxx.se/mail/lib-2008-05/0011.html
  • Loading branch information
bagder committed May 3, 2008
1 parent 3d29bda commit b84b71f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Expand Up @@ -7,6 +7,13 @@
Changelog


Daniel Stenberg (3 May 2008)
- Jean-Francois Bertrand reported a libcurl crash with CURLOPT_TCP_NODELAY
since libcurl used getprotobyname() and that isn't thread-safe. We now
switched to use IPPROTO_TCP unconditionally, but perhaps the proper fix is
to detect the thread-safe version of the function and use that.
http://curl.haxx.se/mail/lib-2008-05/0011.html

Daniel Stenberg (1 May 2008)
- Bart Whiteley provided a patch that made libcurl work properly when an app
uses the CURLOPT_OPENSOCKETFUNCTION callback to create a unix domain socket
Expand Down
5 changes: 3 additions & 2 deletions RELEASE-NOTES
Expand Up @@ -26,7 +26,8 @@ This release includes the following bugfixes:
o the typechecker can be bypassed by defining CURL_DISABLE_TYPECHECK
o a pointer mixup could make the FTP code send bad user+password under rare
circumstances (found when using curlftpfs)
o the CURLOPT_OPENSOCKETFUNCTION can now be used to create a unix domain socket
o CURLOPT_OPENSOCKETFUNCTION can now be used to create a unix domain socket
o CURLOPT_TCP_NODELAY crash due to getprotobyname() use

This release includes the following known bugs:

Expand All @@ -47,6 +48,6 @@ advice from friends like these:

Michal Marek, Daniel Fandrich, Scott Barrett, Alexey Simak, Daniel Black,
Rafa Muyo, Andre Guibert de Bruet, Brock Noland, Sandor Feldi, Stefan Krause,
David Shaw, Norbert Frese, Bart Whiteley
David Shaw, Norbert Frese, Bart Whiteley, Jean-Francois Bertrand

Thanks! (and sorry if I forgot to mention someone)
9 changes: 8 additions & 1 deletion lib/connect.c
Expand Up @@ -685,7 +685,14 @@ static void tcpnodelay(struct connectdata *conn,
socklen_t onoff = (socklen_t) data->set.tcp_nodelay;
int proto = IPPROTO_TCP;

#ifdef HAVE_GETPROTOBYNAME
#if 0
/* The use of getprotobyname() is disabled since it isn't thread-safe on
numerous systems. On these getprotobyname_r() should be used instead, but
that exists in at least one 4 arg version and one 5 arg version, and
since the proto number rarely changes anyway we now just use the hard
coded number. The "proper" fix would need a configure check for the
correct function much in the same style the gethostbyname_r versions are
detected. */
struct protoent *pe = getprotobyname("tcp");
if(pe)
proto = pe->p_proto;
Expand Down

0 comments on commit b84b71f

Please sign in to comment.