From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:45 +0000 (-0700) Subject: Revert previous commit. X-Git-Tag: stable-10.2.0~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b51fee38c87ecccd7774107e22b85f0eea1a7309;p=thirdparty%2Fopen-vm-tools.git Revert previous commit. --- diff --git a/open-vm-tools/lib/misc/strutil.c b/open-vm-tools/lib/misc/strutil.c index b5c616a6a..52d2f5320 100644 --- a/open-vm-tools/lib/misc/strutil.c +++ b/open-vm-tools/lib/misc/strutil.c @@ -26,7 +26,6 @@ #include #include #include -#include #if !defined(_WIN32) #include /* For strncasecmp */ #endif @@ -1141,21 +1140,15 @@ StrUtil_SafeDynBufPrintf(DynBuf *b, // IN/OUT */ void -StrUtil_SafeStrcat(char **prefix, // IN/OUT: - const char *str) // IN: +StrUtil_SafeStrcat(char **prefix, // IN/OUT + const char *str) // IN { char *tmp; - size_t plen = (*prefix == NULL) ? 0 : strlen(*prefix); + size_t plen = *prefix != NULL ? strlen(*prefix) : 0; size_t slen = strlen(str); - /* - * If we're manipulating strings that are anywhere near max(size_t)/2 in - * length we're doing something very wrong. Avoid potential overflow by - * checking for "insane" operations. Prevent the problem before it gets - * started. - */ - - VERIFY((plen < (SIZE_MAX/2)) && (slen < (SIZE_MAX/2))); + /* Check for overflow */ + VERIFY((size_t)-1 - plen > slen + 1); tmp = Util_SafeRealloc(*prefix, plen + slen + 1 /* NUL */);