Use strncpy instead of strcpy because again, buffer overflows

This commit is contained in:
Glenn Smith 2018-03-06 01:59:05 -05:00
parent 7769da9434
commit 79c34c68db
92 changed files with 298 additions and 279 deletions

View file

@ -194,7 +194,7 @@ char* afxRPGMagicSpellData::fmt_placeholder_desc(char* buffer, int len) const
{
char pack_str[32];
if (source_pack == ST_NULLSTRING)
dStrcpy(pack_str, "unknown");
dStrcpy(pack_str, "unknown", 32);
else
dSprintf(pack_str, 32, "%s", source_pack);
@ -225,7 +225,7 @@ char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const
{
if (spell_target != TARGET_NOTHING)
{
dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName);
dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName, 32);
if (spell_target != TARGET_FREE && target_optional)
dStrcat(target_str, " (opt)", 32);
}
@ -245,13 +245,13 @@ char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const
char casting_str[32];
if (casting_dur <= 0)
dStrcpy(casting_str, "instant");
dStrcpy(casting_str, "instant", 32);
else
dSprintf(casting_str, 32, "%.1f sec cast", casting_dur);
char pack_str[32];
if (source_pack == ST_NULLSTRING)
dStrcpy(pack_str, "unknown");
dStrcpy(pack_str, "unknown", 32);
else
dSprintf(pack_str, 32, "%s", source_pack);