]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix Digest auth parameter parsing (#415)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sat, 8 Jun 2019 21:09:23 +0000 (21:09 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 9 Jul 2019 12:03:28 +0000 (00:03 +1200)
Only remove quoting if the domain=, uri= or qop= parameter
value is surrounded by double-quotes.

src/auth/digest/Config.cc

index 674dd93cd287a14936f601a624102279fe6769c0..d2cd2e96e534b8c0a66e80d9d6de09fb29d96e4b 100644 (file)
@@ -781,14 +781,14 @@ Auth::Digest::Config::decode(char const *proxy_auth, const char *aRequestRealm)
             if (keyName == SBuf("domain",6) || keyName == SBuf("uri",3)) {
                 // domain is Special. Not a quoted-string, must not be de-quoted. But is wrapped in '"'
                 // BUG 3077: uri= can also be sent to us in a mangled (invalid!) form like domain
-                if (*p == '"' && *(p + vlen -1) == '"') {
+                if (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
                     value.limitInit(p+1, vlen-2);
                 }
             } else if (keyName == SBuf("qop",3)) {
                 // qop is more special.
                 // On request this must not be quoted-string de-quoted. But is several values wrapped in '"'
                 // On response this is a single un-quoted token.
-                if (*p == '"' && *(p + vlen -1) == '"') {
+                if (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
                     value.limitInit(p+1, vlen-2);
                 } else {
                     value.limitInit(p, vlen);