From 631540c4000e0d9236fe52b48b1c4e70497ee3b4 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;