From: Oliver Kurth Date: Fri, 15 Sep 2017 18:22:46 +0000 (-0700) Subject: lib/string: Str_Strncat boundary check improvement to prevent buffer overflow. X-Git-Tag: stable-10.2.0~690 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3138663e346e46edbb2dbb3f6d3da6c53f6db5d6;p=thirdparty%2Fopen-vm-tools.git lib/string: Str_Strncat boundary check improvement to prevent buffer overflow. --- diff --git a/open-vm-tools/lib/string/str.c b/open-vm-tools/lib/string/str.c index 8568414c9..79e77cab9 100644 --- a/open-vm-tools/lib/string/str.c +++ b/open-vm-tools/lib/string/str.c @@ -465,6 +465,7 @@ Str_Strncat(char *buf, // IN/OUT */ bufLen = strlen(buf); + bufLen = MIN(bufLen, bufSize); // Prevent potential overflow if (!(bufLen + n < bufSize || bufLen + strlen(src) < bufSize)) {