aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-02-24 14:50:20 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-02-24 14:50:20 +0000
commit30639ed72b2d0552435e22f17d1e2cebc86cc4ea (patch)
tree2df9eb6068d5830257cd71434b0b7b0dc0e32c7c
parent9d02a39e1388f9c215ea1f03e4703ace615d6354 (diff)
Kjetil Jacobsen found out that setting CURLOPT_MAXCONNECTS to a value higher
than 5 could cause a segfault.
-rw-r--r--lib/url.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 0836b24ab..865c247d5 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -378,12 +378,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
Curl_disconnect(data->state.connects[i]);
}
if(newconnects) {
+ int i;
newptr= (struct connectdata **)
realloc(data->state.connects,
sizeof(struct connectdata *) * newconnects);
if(!newptr)
/* we closed a few connections in vain, but so what? */
return CURLE_OUT_OF_MEMORY;
+
+ /* nullify the newly added pointers */
+ for(i=data->state.numconnects; i<newconnects; i++) {
+ newptr[i] = NULL;
+ }
+
data->state.connects = newptr;
data->state.numconnects = newconnects;
}