summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:56 +0100
committerBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:56 +0100
commit21662efacea883135f3a7cf67defe32ab872055a (patch)
tree3e49d22d99d03d4703ff9c0d61689b05f1d8924d
parent346facaf00dc40001da8274df86a9094d509802b (diff)
Fix buffer overflow in askfor_aux()
-rw-r--r--src/cmd3.cc2
-rw-r--r--src/util.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd3.cc b/src/cmd3.cc
index ba96a44b..acb0ac73 100644
--- a/src/cmd3.cc
+++ b/src/cmd3.cc
@@ -816,7 +816,7 @@ void do_cmd_inscribe(void)
}
/* Get a new inscription (possibly empty) */
- if (get_string("Inscription: ", out_val, 80))
+ if (get_string("Inscription: ", out_val, sizeof(out_val)))
{
/* Save the inscription */
o_ptr->note = quark_add(out_val);
diff --git a/src/util.cc b/src/util.cc
index 550fc9e4..a9769d31 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -2458,7 +2458,7 @@ bool_ askfor_aux(char *buf, int len)
/* Paranoia -- Clip the default entry */
- buf[len] = '\0';
+ buf[len - 1] = '\0';
/* Display the default answer */