summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2013-06-30 08:29:51 +0000
committeralberth <alberth@openttd.org>2013-06-30 08:29:51 +0000
commit631540c4000e0d9236fe52b48b1c4e70497ee3b4 (patch)
treeca34573c7ffa44fdf4ca9fdbfa3e0b4361d551d1 /src/string.cpp
parent92f276f26d9a61734a79c774ba1150db82dee86c (diff)
downloadopenttd-631540c4000e0d9236fe52b48b1c4e70497ee3b4.tar.xz
(svn r25527) -Fix[FS#5621]: strndup should not examine strings beyond its upper limit.
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 7557f6d1d..b543ab868 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<char>(len + 1);
memcpy(tmp, s, len);
return tmp;