Sanitize petnames and fruit to prevent escape codes

This commit is contained in:
Pasi Kallinen
2015-03-02 20:10:18 +02:00
parent b4fa80ec7d
commit 019b24005f
2 changed files with 5 additions and 0 deletions

View File

@@ -865,6 +865,7 @@ all sources of erosion now affect objects the same way
passive attacks no longer erode armor covered by other armor
dipping a fooproof item into acid no longer forgets that it's fooproof
dipping a container into uncursed water now gets its contents wet
sanitize petnames and fruit to prevent escape codes
Platform- and/or Interface-Specific Fixes
-----------------------------------------

View File

@@ -1300,6 +1300,7 @@ boolean tinitial, tfrom_file;
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
nmcpy(catname, op, PL_PSIZ);
sanitize_name(catname);
return;
}
@@ -1309,6 +1310,7 @@ boolean tinitial, tfrom_file;
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
nmcpy(dogname, op, PL_PSIZ);
sanitize_name(dogname);
return;
}
@@ -1318,6 +1320,7 @@ boolean tinitial, tfrom_file;
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
nmcpy(horsename, op, PL_PSIZ);
sanitize_name(horsename);
return;
}
@@ -1662,6 +1665,7 @@ boolean tinitial, tfrom_file;
}
goodfruit:
nmcpy(pl_fruit, op, PL_FSIZ);
sanitize_name(pl_fruit);
/* OBJ_NAME(objects[SLIME_MOLD]) won't work after initialization */
if (!*pl_fruit)
nmcpy(pl_fruit, "slime mold", PL_FSIZ);