From cb634db2eca3857290fd16f75627a506d6aea32a Mon Sep 17 00:00:00 2001 From: adiblol Date: Sun, 30 Sep 2012 16:00:34 +0200 Subject: Fixed segfault when using empty strings with CBotString::operator+ --- src/CBot/CBotString.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/CBot') diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp index e52cd05..6f48127 100644 --- a/src/CBot/CBotString.cpp +++ b/src/CBot/CBotString.cpp @@ -357,9 +357,9 @@ const CBotString& CBotString::operator+(const CBotString& stringSrc) { char* p = static_cast(malloc(m_lg+stringSrc.m_lg+1)); - strcpy(p, m_ptr); + if (m_ptr!=NULL) strcpy(p, m_ptr); char* pp = p + m_lg; - strcpy(pp, stringSrc.m_ptr); + if (stringSrc.m_ptr!=NULL) strcpy(pp, stringSrc.m_ptr); free(m_ptr); m_ptr = p; -- cgit v1.2.3-1-g7c22