1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

fixed conn->name error on connection re-use and enlarged the 'gname' array

to hold 512 bytes (for user+password+hostname)
This commit is contained in:
Daniel Stenberg 2001-10-29 10:10:21 +00:00
parent 3edd9b4dfc
commit 42a9d96fae
2 changed files with 3 additions and 4 deletions

View File

@ -1280,14 +1280,14 @@ static CURLcode CreateConnection(struct SessionHandle *data,
strcpy(conn->path, "/"); strcpy(conn->path, "/");
if (2 > sscanf(data->change.url, if (2 > sscanf(data->change.url,
"%64[^\n:]://%256[^\n/]%[^\n]", "%64[^\n:]://%512[^\n/]%[^\n]",
conn->protostr, conn->gname, conn->path)) { conn->protostr, conn->gname, conn->path)) {
/* /*
* The URL was badly formatted, let's try the browser-style _without_ * The URL was badly formatted, let's try the browser-style _without_
* protocol specified like 'http://'. * protocol specified like 'http://'.
*/ */
if((1 > sscanf(data->change.url, "%256[^\n/]%[^\n]", if((1 > sscanf(data->change.url, "%512[^\n/]%[^\n]",
conn->gname, conn->path)) ) { conn->gname, conn->path)) ) {
/* /*
* We couldn't even get this format. * We couldn't even get this format.
@ -1872,7 +1872,6 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn = conn_temp; /* use this connection from now on */ conn = conn_temp; /* use this connection from now on */
/* we need these pointers if we speak over a proxy */ /* we need these pointers if we speak over a proxy */
conn->name = conn->gname;
conn->hostname = old_conn->gname; conn->hostname = old_conn->gname;
free(conn->path); /* free the previously allocated path pointer */ free(conn->path); /* free the previously allocated path pointer */

View File

@ -233,7 +233,7 @@ struct connectdata {
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr;
#endif #endif
char protostr[64]; /* store the protocol string in this buffer */ char protostr[64]; /* store the protocol string in this buffer */
char gname[257]; /* store the hostname in this buffer */ char gname[513]; /* store the hostname in this buffer */
char *name; /* host name pointer to fool around with */ char *name; /* host name pointer to fool around with */
char *path; /* allocated buffer to store the URL's path part in */ char *path; /* allocated buffer to store the URL's path part in */
char *hostname; /* hostname to connect, as parsed from url */ char *hostname; /* hostname to connect, as parsed from url */