Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From c4107990d29aa048845b9851791c9b773fda9693 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Mon, 1 Mar 2021 22:41:05 +0000
>Subject: [PATCH] keymap.c: use "invalid" and "snprintf()"

  Use "invalid" instead of "illegal", see GNU standard.

  Use "snprintf()" instead of "sprintf()".

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 keymap.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/keymap.c b/keymap.c
index bedeb34..fee9bbf 100644
--- a/keymap.c
+++ b/keymap.c
@@ -249,7 +249,7 @@ int             more_key_map[KEY_MAP_SIZE] = {
 /*
  * standard keyboard mappings for menu()
  *
- *     illegal command
+ *     invalid command
  *     redraw                  ^L, ^R
  *     continue                space
  *     continue no mark        return, newline
@@ -783,7 +783,8 @@ parse_key(char *str)
 char           *
 key_name(key_type c)
 {
-    static char     buf[10];
+#define    NBUF  10
+    static char     buf[NBUF];
 
     if (c >= NORMAL_KEYS && c <= (key_type) (KEY_MAP_SIZE - NATIONAL_KEYS)) {
        switch (c) {
@@ -829,7 +830,7 @@ key_name(key_type c)
        goto out;
     }
     if (data_bits < 8 && c >= NORMAL_KEYS) {
-       sprintf(buf, "0x%02x", (uint)c);
+       snprintf(buf, NBUF, "0x%02x", (uint)c);
        goto out;
     }
     buf[0] = c;
-- 
2.30.1



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to