Bladeren bron

Add a comment

Ben Payne 10 jaren geleden
bovenliggende
commit
16af2a126e
1 gewijzigde bestanden met toevoegingen van 3 en 1 verwijderingen
  1. 3 1
      Engine/source/gui/controls/guiTextCtrl.cpp

+ 3 - 1
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';