]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ensure null-termination of string in negotiate_wrapper (#1031)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 7 May 2022 11:03:32 +0000 (11:03 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 7 May 2022 11:26:21 +0000 (11:26 +0000)
Coverity identified a theoretical chance that a buffer may not be
null-terminated in negotiate_wrapper. The code flow is clean, adding a
forced null termination to apply defensive programming practices.

src/auth/negotiate/wrapper/negotiate_wrapper.cc

index 7f53e2ba619f015d2ffaac70885978d7327c8fe5..bd6932243368f80fb6d1edbe7800a652717fa2e2 100644 (file)
@@ -257,6 +257,7 @@ processingLoop(FILE *FDKIN, FILE *FDKOUT, FILE *FDNIN, FILE *FDNOUT)
                 return 0;
             }
         }
+        buff[sizeof(buff)-1] = '\0'; // paranoid; already terminated correctly
         fprintf(stdout,"%s",buff);
         if (debug_enabled)
             fprintf(stderr, "%s| %s: Return '%s'\n",