Merge pull request #1239 from bpay/asan-fixes

Fix errors flagged by address sanitizer
This commit is contained in:
Areloch 2015-04-16 21:12:21 -05:00
commit 6e681dd82f
2 changed files with 8 additions and 4 deletions

View file

@ -187,8 +187,10 @@ void GuiTextCtrl::setText(const char *txt)
//make sure we don't call this before onAdd();
if( !mProfile )
return;
if (txt)
// The txt pointer is sometimes the same as the mText pointer, so make sure
// we don't call strncpy with overlapping src and dest.
if (txt && txt != mText)
dStrncpy(mText, (UTF8*)txt, MAX_STRING_LENGTH);
mText[MAX_STRING_LENGTH] = '\0';