From 65ad598418b11f81ca655fa425cffe34a77e69b9 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Sun, 16 Mar 2025 14:15:56 +0000 Subject: [PATCH] negotiate_sspi_auth: Fix command debugging (-v) (#2025) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc index 860a6c8901..6a257ae14f 100644 --- a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc +++ b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc @@ -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(decoded), decodedLen); } else -- 2.47.2