mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
Kjetil Jacobsen found out that setting CURLOPT_MAXCONNECTS to a value higher
than 5 could cause a segfault.
This commit is contained in:
parent
9d02a39e13
commit
30639ed72b
@ -378,12 +378,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
Curl_disconnect(data->state.connects[i]);
|
Curl_disconnect(data->state.connects[i]);
|
||||||
}
|
}
|
||||||
if(newconnects) {
|
if(newconnects) {
|
||||||
|
int i;
|
||||||
newptr= (struct connectdata **)
|
newptr= (struct connectdata **)
|
||||||
realloc(data->state.connects,
|
realloc(data->state.connects,
|
||||||
sizeof(struct connectdata *) * newconnects);
|
sizeof(struct connectdata *) * newconnects);
|
||||||
if(!newptr)
|
if(!newptr)
|
||||||
/* we closed a few connections in vain, but so what? */
|
/* we closed a few connections in vain, but so what? */
|
||||||
return CURLE_OUT_OF_MEMORY;
|
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.connects = newptr;
|
||||||
data->state.numconnects = newconnects;
|
data->state.numconnects = newconnects;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user