]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/string: Str_Strncat boundary check improvement to prevent buffer overflow.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:46 +0000 (11:22 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:46 +0000 (11:22 -0700)
open-vm-tools/lib/string/str.c

index 8568414c92032823de17c37ac2db07609b79d396..79e77cab97acc756ef8167b3bb57f9388ef4eb40 100644 (file)
@@ -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)) {