Selaa lähdekoodia

Don't call strncpy when src == dest

This fixes an error flagged by address sanitizer
Ben Payne 10 vuotta sitten
vanhempi
commit
bd49fe3cb0
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      Engine/source/gui/controls/guiTextCtrl.cpp

+ 1 - 1
Engine/source/gui/controls/guiTextCtrl.cpp

@@ -188,7 +188,7 @@ void GuiTextCtrl::setText(const char *txt)
    if( !mProfile )
       return;
    
-   if (txt)
+   if (txt && txt != mText)
       dStrncpy(mText, (UTF8*)txt, MAX_STRING_LENGTH);
    mText[MAX_STRING_LENGTH] = '\0';