From: Francesco Chemolli Date: Sat, 7 May 2022 11:03:32 +0000 (+0000) Subject: Ensure null-termination of string in negotiate_wrapper (#1031) X-Git-Tag: SQUID_6_0_1~192 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=265d1cc516f56a70fb142ee0ccdc74fc8fbe09d7;p=thirdparty%2Fsquid.git Ensure null-termination of string in negotiate_wrapper (#1031) 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. --- diff --git a/src/auth/negotiate/wrapper/negotiate_wrapper.cc b/src/auth/negotiate/wrapper/negotiate_wrapper.cc index 7f53e2ba61..bd69322433 100644 --- a/src/auth/negotiate/wrapper/negotiate_wrapper.cc +++ b/src/auth/negotiate/wrapper/negotiate_wrapper.cc @@ -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",