From 16af2a126e670c10eb3929c1289269c15107769c Mon Sep 17 00:00:00 2001 From: Ben Payne Date: Fri, 6 Mar 2015 15:36:22 -0500 Subject: [PATCH] Add a comment --- Engine/source/gui/controls/guiTextCtrl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/gui/controls/guiTextCtrl.cpp b/Engine/source/gui/controls/guiTextCtrl.cpp index 3c1f1a8c9..e1079d8e0 100644 --- a/Engine/source/gui/controls/guiTextCtrl.cpp +++ b/Engine/source/gui/controls/guiTextCtrl.cpp @@ -187,7 +187,9 @@ void GuiTextCtrl::setText(const char *txt) //make sure we don't call this before onAdd(); if( !mProfile ) return; - + + // 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';