From a9b1bade75e1d2404b2f688111505a89d4f72c6c Mon Sep 17 00:00:00 2001
From: Andrei Cipu <acipu@ixiacom.com>
Date: Wed, 4 Apr 2012 15:35:24 +0300
Subject: [PATCH] IPv6 cookie domain: get rid of the first bracket before the
 second.

Commit 97b66ebe was copying a smaller buffer, thus duplicating the last character.
---
 lib/http.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/http.c b/lib/http.c
index 1d0c83f..ab3d5a5 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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, ':');
-- 
1.7.7

