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>
This commit is contained in:
parent
9dad482ad8
commit
355687b644
@ -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),
|
(void)strncpy (key, keys_action_firstkey (binding[i + 1]->action),
|
||||||
KEYS_KEYLEN);
|
KEYS_KEYLEN);
|
||||||
|
key[KEYS_KEYLEN] = 0;
|
||||||
fmtkey = keys_format_label (key, KEYS_KEYLEN);
|
fmtkey = keys_format_label (key, KEYS_KEYLEN);
|
||||||
mvwprintw (win, 1, KEY_POS, fmtkey);
|
mvwprintw (win, 1, KEY_POS, fmtkey);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user