From 2005b4fed4dcfc17ec46d21ce093dbc6a368083b Mon Sep 17 00:00:00 2001
From: Nicky <none@none>
Date: Thu, 12 Jul 2012 18:04:53 +0200
Subject: [PATCH] Crashfix: in ll_safe_string not only guard against 0 pointer,
 but against illegal length of buffer too.

---
 indra/llcommon/llstring.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index fa0eb9f72c7..0c326797449 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -47,7 +47,8 @@ std::string ll_safe_string(const char* in)
 
 std::string ll_safe_string(const char* in, S32 maxlen)
 {
-	if(in) return std::string(in, maxlen);
+	if(in && maxlen > 0 ) return std::string(in, maxlen);
+
 	return std::string();
 }
 
-- 
GitLab