[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 107/163: url: fix dangling conn->data pointer
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 107/163: url: fix dangling conn->data pointer |
Date: |
Sun, 05 Aug 2018 12:37:13 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 2c15693a3c355d8296a1828123a864397296460b
Author: Daniel Stenberg <address@hidden>
AuthorDate: Wed Jun 20 23:00:36 2018 +0200
url: fix dangling conn->data pointer
By masking sure to use the *current* easy handle with extracted
connections from the cache, and make sure to NULLify the ->data pointer
when the connection is put into the cache to make this mistake easier to
detect in the future.
Reported-by: Will Dietz
Fixes #2669
Closes #2672
---
lib/conncache.c | 3 ++-
lib/connect.c | 6 ++++--
lib/url.c | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/conncache.c b/lib/conncache.c
index 6bd06582a..066542915 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <address@hidden>
- * Copyright (C) 2012 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2012 - 2018, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -451,6 +451,7 @@ bool Curl_conncache_return_conn(struct connectdata *conn)
}
CONN_LOCK(data);
conn->inuse = FALSE; /* Mark the connection unused */
+ conn->data = NULL; /* no owner */
CONN_UNLOCK(data);
return (conn_candidate == conn) ? FALSE : TRUE;
diff --git a/lib/connect.c b/lib/connect.c
index 12ae817e3..41f220268 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1259,9 +1259,11 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
return CURL_SOCKET_BAD;
}
- if(connp)
+ if(connp) {
/* only store this if the caller cares for it */
*connp = c;
+ c->data = data;
+ }
return c->sock[FIRSTSOCKET];
}
else
diff --git a/lib/url.c b/lib/url.c
index d29eddaea..0cab0a303 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -965,6 +965,7 @@ static bool extract_if_dead(struct connectdata *conn,
use */
bool dead;
+ conn->data = data;
if(conn->handler->connection_check) {
/* The protocol has a special method for checking the state of the
connection. Use it to check if the connection is dead. */
@@ -979,7 +980,6 @@ static bool extract_if_dead(struct connectdata *conn,
}
if(dead) {
- conn->data = data;
infof(data, "Connection %ld seems to be dead!\n", conn->connection_id);
Curl_conncache_remove_conn(conn, FALSE);
return TRUE;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 82/163: test 46: make test pass after 2025, (continued)
- [GNUnet-SVN] [gnurl] 82/163: test 46: make test pass after 2025, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 84/163: schannel: avoid incompatible pointer warning, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 89/163: progress: remove a set of unused defines, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 70/163: axtls: follow-up spell fix of comment, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 91/163: KNOWN_BUGS: slow connect to localhost on Windows, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 80/163: openssl: assume engine support in 1.0.1 or later, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 136/163: DEPRECATE: include year when specifying date, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 95/163: configure: enhance ability to detect/build with static openssl, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 108/163: cmake: allow multiple SSL backends, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 86/163: runtests: support variables in <strippart>, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 107/163: url: fix dangling conn->data pointer,
gnunet <=
- [GNUnet-SVN] [gnurl] 109/163: system.h: fix for gcc on 32 bit OpenServer, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 123/163: configure: remove CURL_CHECK_NI_WITHSCOPEID too, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 112/163: CURLOPT_SSL_VERIFYPEER.3: Add performance note, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 88/163: TODO: "Option to refuse usernames in URLs" done, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 126/163: openssl: allow TLS 1.3 by default, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 61/163: KNOWN_BUGS: CURL_GLOBAL_SSL, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 57/163: option: disallow username in URL, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 102/163: runtests.pl: remove debug leftover from bb9a340c73f3, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 87/163: Curl_init_do: handle NULL connection pointer passed in, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 146/163: scripts: include _curl as part of CLEANFILES, gnunet, 2018/08/05