diff options
author | alberth <alberth@openttd.org> | 2013-06-30 08:29:51 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2013-06-30 08:29:51 +0000 |
commit | 631540c4000e0d9236fe52b48b1c4e70497ee3b4 (patch) | |
tree | ca34573c7ffa44fdf4ca9fdbfa3e0b4361d551d1 | |
parent | 92f276f26d9a61734a79c774ba1150db82dee86c (diff) | |
download | openttd-631540c4000e0d9236fe52b48b1c4e70497ee3b4.tar.xz |
(svn r25527) -Fix[FS#5621]: strndup should not examine strings beyond its upper limit.
-rw-r--r-- | src/string.cpp | 3 |
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; |