From f618b6e2f97a98d98ecb3f9ddca6b2fbbb94cd1c Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 30 Jun 2013 08:29:51 +0000 Subject: [PATCH] (svn r25527) -Fix[FS#5621]: strndup should not examine strings beyond its upper limit. --- src/string.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/string.cpp b/src/string.cpp index 7557f6d1d8..b543ab868e 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -560,10 +560,9 @@ size_t Utf8TrimString(char *s, size_t maxlen) } #ifdef DEFINE_STRNDUP -#include "core/math_func.hpp" char *strndup(const char *s, size_t len) { - len = min(strlen(s), len); + len = ttd_strnlen(s, len); char *tmp = CallocT(len + 1); memcpy(tmp, s, len); return tmp;