From d829b92f0e58d18c78c8b857d2eaae6a05f58351 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 2 Mar 2015 20:10:18 +0200 Subject: [PATCH] Sanitize petnames and fruit to prevent escape codes --- doc/fixes35.0 | 1 + src/options.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index d3f6b1a90..1e31bf65a 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 ----------------------------------------- diff --git a/src/options.c b/src/options.c index 54ad99efc..229c2df91 100644 --- a/src/options.c +++ b/src/options.c @@ -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); -- 2.40.0