summaryrefslogtreecommitdiff
path: root/src/keys.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-03-05 15:38:55 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2011-03-05 15:39:01 +0100
commit355687b644f274cf73b658e075bdd9947583559c (patch)
tree1e7e0c87953a524794c099076308353ff78583d9 /src/keys.c
parent9dad482ad8bcf10956f20902cc18289c927a457b (diff)
downloadcalcurse-355687b644f274cf73b658e075bdd9947583559c.zip
Ensure key descriptions in status bar are always null-terminated.
Key descriptions are just strncpy()'ed to key[], with KEYS_KEYLEN as maximum character count. This leads to a non-null-terminated string if the source pointer actually points to a string with a length of KEYS_KEYLEN bytes. Always appending a null character fixes this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/keys.c')
-rw-r--r--src/keys.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/keys.c b/src/keys.c
index d465e85..93978f4 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -472,6 +472,7 @@ keys_display_bindings_bar (WINDOW *win, struct binding **binding, int first_key,
{
(void)strncpy (key, keys_action_firstkey (binding[i + 1]->action),
KEYS_KEYLEN);
+ key[KEYS_KEYLEN] = 0;
fmtkey = keys_format_label (key, KEYS_KEYLEN);
mvwprintw (win, 1, KEY_POS, fmtkey);
}