]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
negotiate_sspi_auth: Fix command debugging (-v) (#2025)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Sun, 16 Mar 2025 14:15:56 +0000 (14:15 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 16 Mar 2025 20:42:25 +0000 (20:42 +0000)
Terminate helper_command buffer before using it as a c-string. Supported
helper commands have two characters.

This change also reduces MinGW build errors.

src/auth/negotiate/SSPI/negotiate_sspi_auth.cc

index 860a6c8901c2fcd2dfc095f83deb32f88463d83e..6a257ae14fff5eae2cd9c35737922fddd2da39c3 100644 (file)
@@ -168,7 +168,7 @@ manage_request()
     if ((strlen(buf) > 3) && Negotiate_packet_debug_enabled) {
         if (!token_decode(&decodedLen, decoded, buf+3))
             return 1;
-        strncpy(helper_command, buf, 2);
+        xstrncpy(helper_command, buf, sizeof(helper_command));
         debug("Got '%s' from Squid with data:\n", helper_command);
         hex_dump(reinterpret_cast<unsigned char*>(decoded), decodedLen);
     } else