diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:56 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:56 +0100 |
commit | 21662efacea883135f3a7cf67defe32ab872055a (patch) | |
tree | 3e49d22d99d03d4703ff9c0d61689b05f1d8924d | |
parent | 346facaf00dc40001da8274df86a9094d509802b (diff) |
Fix buffer overflow in askfor_aux()
-rw-r--r-- | src/cmd3.cc | 2 | ||||
-rw-r--r-- | src/util.cc | 2 |
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 */ |