From 95d07ef1f9c12eafbe107630716d248ebe3c1c38 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 24 Sep 2008 22:20:04 +0000 Subject: [PATCH] * cut all left of webcit= from cookies * some header analyzers were still operating on old buffers; thanks to samjam for pointing this out. --- webcit/cookie_conversion.c | 6 ++++-- webcit/webcit.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 9bd90ca54..844798ea0 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -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; diff --git a/webcit/webcit.c b/webcit/webcit.c index 78d519332..e03a81545 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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) && -- 2.30.2