]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
We don't support any long protocol names so we can use a smaller buffer.
authorDaniel Stenberg <daniel@haxx.se>
Fri, 7 May 2004 18:46:28 +0000 (18:46 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 7 May 2004 18:46:28 +0000 (18:46 +0000)
Also, make sure we have room for the trailing zero, only scan to size-1.

Gisle Vanem reported.

lib/url.c
lib/urldata.h

index 830ab9d3048275f8140c098fd11da9980cbfe702..fc7a9d4e0be293961ad637e086cfe9d2ab6e1082 100644 (file)
--- 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)) {
 
index 8d29cf66e90e9cb7e71cffd46d1da3ce0781e2e6..e1fdcc288d3634221b7c9d1396a56a7c98aae2af 100644 (file)
@@ -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;