]> granicus.if.org Git - curl/commitdiff
IPv6 cookie domain: get rid of the first bracket before the second.
authorAndrei Cipu <acipu@ixiacom.com>
Wed, 4 Apr 2012 12:35:24 +0000 (15:35 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 4 Apr 2012 21:51:41 +0000 (23:51 +0200)
Commit 97b66ebe was copying a smaller buffer, thus duplicating the last
character.

lib/http.c

index ec76bbe46be227aae6c22129cc76fe09465cac61..0ce575ba8c5f88fec0a7ba6aa47646a670fd5ba5 100644 (file)
@@ -1852,12 +1852,12 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       int startsearch = 0;
       if(*cookiehost == '[') {
         char *closingbracket;
-        closingbracket = strchr(cookiehost+1, ']');
-        if(closingbracket)
-          *closingbracket = 0;
         /* since the 'cookiehost' is an allocated memory area that will be
            freed later we cannot simply increment the pointer */
         memmove(cookiehost, cookiehost + 1, strlen(cookiehost) - 1);
+        closingbracket = strchr(cookiehost, ']');
+        if(closingbracket)
+          *closingbracket = 0;
       }
       else {
         char *colon = strchr(cookiehost + startsearch, ':');