changeset 20586:4710e1baf8f7 draft

(svn r25527) -Fix[FS#5621]: strndup should not examine strings beyond its upper limit.
author alberth <alberth@openttd.org>
date Sun, 30 Jun 2013 08:29:51 +0000
parents 9f2dff69f042
children 3ebf57ab8def
files src/string.cpp
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -560,10 +560,9 @@
 }
 
 #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;