* cut all left of webcit= from cookies
authorWilfried Göesgens <willi@citadel.org>
Wed, 24 Sep 2008 22:20:04 +0000 (22:20 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 24 Sep 2008 22:20:04 +0000 (22:20 +0000)
* some header analyzers were still operating on old buffers; thanks to samjam for pointing this out.

webcit/cookie_conversion.c
webcit/webcit.c

index 9bd90ca54be190929c95f1c88b6c1e778569d058..844798ea06bf94673561d6e1b7ca736e9e21ccf4 100644 (file)
@@ -86,8 +86,10 @@ void cookie_to_stuff(StrBuf *cookie, int *session,
        char buf[SIZ];
        int i, len;
 
-       if (strncmp(ChrPtr(cookie), "webcit=", (sizeof("webcit=") - 1)) == 0)
-               StrBufCutLeft(cookie, 7);
+       pch = strstr(ChrPtr(cookie), "webcit=");
+       
+       if (pch != NULL)
+               StrBufCutLeft(cookie, (pch - ChrPtr(cookie)) + 7);
 
        strcpy(buf, "");
        len = StrLength(cookie) / 2;
index 78d5193329ed023b9fce8e0ec50be7a4de45078f..e03a8154595034ceb35ca213967f218433bf5caa 100644 (file)
@@ -1436,7 +1436,9 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
        if ((follow_xff) &&
            GetHash(HTTPHeaders, HKEY("X-FORWARDED-HOST"), &vLine) &&
            (vLine != NULL)) {
-               safestrncpy(WCC->http_host, &buf[18], sizeof WCC->http_host);
+               safestrncpy(WCC->http_host, 
+                           ChrPtr((StrBuf*)vLine), 
+                           sizeof WCC->http_host);
        }
        if (IsEmptyStr(WCC->http_host) && 
            GetHash(HTTPHeaders, HKEY("HOST"), &vLine) &&