Sanitize petnames and fruit to prevent escape codes

This commit is contained in:
Pasi Kallinen
2015-03-02 20:10:18 +02:00
parent bd62873ee2
commit d829b92f0e
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 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 fooproof item into acid no longer forgets that it's fooproof
dipping a container into uncursed water now gets its contents wet 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 Platform- and/or Interface-Specific Fixes
----------------------------------------- -----------------------------------------

View File

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