]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
negotiate_wrapper: Search buffer with strchr instead of memchr (#2176)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Wed, 3 Sep 2025 17:36:49 +0000 (17:36 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 3 Sep 2025 21:23:36 +0000 (21:23 +0000)
Previously, memchr would search tainted data.

src/auth/negotiate/wrapper/negotiate_wrapper.cc

index 2ac4e58201a0f16ce09f3ca1ed25b6485b500fae..425434d22f083c0ba404c504e5c827b753018a70 100644 (file)
@@ -128,7 +128,7 @@ processingLoop(FILE *FDKIN, FILE *FDKOUT, FILE *FDNIN, FILE *FDNOUT)
             fprintf(stdout, "BH input error\n");
             return 0;
         }
-        c = static_cast<char*>(memchr(buf, '\n', sizeof(buf) - 1));
+        c = strchr(buf, '\n');
         if (c) {
             *c = '\0';
             length = c - buf;
@@ -221,7 +221,7 @@ processingLoop(FILE *FDKIN, FILE *FDKOUT, FILE *FDNIN, FILE *FDNOUT)
                 return 0;
             }
 
-            if (!memchr(tbuff, '\n', sizeof(tbuff) - 1)) {
+            if (!strchr(tbuff, '\n')) {
                 fprintf(stderr, "%s| %s: Oversized NTLM helper response\n",
                         LogTime(), PROGRAM);
                 return 0;
@@ -260,7 +260,7 @@ processingLoop(FILE *FDKIN, FILE *FDKOUT, FILE *FDNIN, FILE *FDNOUT)
                 return 0;
             }
 
-            if (!memchr(buff, '\n', sizeof(buff) - 1)) {
+            if (!strchr(buff, '\n')) {
                 fprintf(stderr, "%s| %s: Oversized Kerberos helper response\n",
                         LogTime(), PROGRAM);
                 return 0;