From: Daniel Stenberg Date: Fri, 7 May 2004 18:46:28 +0000 (+0000) Subject: We don't support any long protocol names so we can use a smaller buffer. X-Git-Tag: curl-7_12_0~160 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3394c01826aef99a645db398c1fb6bce4693bd35;p=thirdparty%2Fcurl.git We don't support any long protocol names so we can use a smaller buffer. Also, make sure we have room for the trailing zero, only scan to size-1. Gisle Vanem reported. --- diff --git a/lib/url.c b/lib/url.c index 830ab9d304..fc7a9d4e0b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2148,7 +2148,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, * proxy -- and we don't know if we will need to use SSL until we parse the * url ... ************************************************************/ - if((2 == sscanf(data->change.url, "%64[^:]:%[^\n]", + if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]", conn->protostr, conn->path)) && strequal(conn->protostr, "file")) { if(conn->path[0] == '/' && conn->path[1] == '/') { @@ -2208,7 +2208,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, * that missing slash at the beginning of the path. */ if (2 > sscanf(data->change.url, - "%64[^\n:]://%[^\n/?]%[^\n]", + "%15[^\n:]://%[^\n/?]%[^\n]", conn->protostr, conn->host.name, conn->path)) { diff --git a/lib/urldata.h b/lib/urldata.h index 8d29cf66e9..e1fdcc288d 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -438,7 +438,7 @@ struct connectdata { #else struct sockaddr_in serv_addr; #endif - char protostr[64]; /* store the protocol string in this buffer */ + char protostr[16]; /* store the protocol string in this buffer */ struct hostname host; struct hostname proxy;