fix(Core): uint32 assignment, prevent crash, closes #2433 (#2435)

* Fixed uint32 assignment, prevent crash

* Improved code quality
This commit is contained in:
Stefano Borzì
2019-11-16 18:44:06 +01:00
committed by GitHub
parent a3206c56dc
commit 293ccc1faf

View File

@@ -333,7 +333,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
{
// found the prefix, remove it to perform spellname validation below
// -2 = strlen(": ")
uint32 spellNameLength = strlen(buffer) - skillLineNameLength - 2;
uint32 spellNameLength = (strlen(buffer) <= skillLineNameLength + 2) ? 0 : strlen(buffer) - skillLineNameLength - 2;
memmove(buffer, buffer + skillLineNameLength + 2, spellNameLength + 1);
break;
}