From 15f2e014d2622c0b80c88bee57b274dd96e884e9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 27 Jun 2020 17:40:18 +0200 Subject: [PATCH] make coverity understand that there is no buffer overflow here. --- src/gmtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gmtool.c b/src/gmtool.c index 394f1efde..798351a8d 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -1514,14 +1514,12 @@ static void handlekey(state * st, int c) } if (wnd == NULL) { static char kbuffer[80]; - if (kbuffer[0] == 0) { + if (kbuffer[0] == 0 || strlen(kbuffer) > 70) { strcpy(kbuffer, "getch:"); } - sprintf(sbuffer, " 0x%x", c); + snprintf(sbuffer, 10, " 0x%x", c); strncat(kbuffer, sbuffer, sizeof(kbuffer) - 1); statusline(st->wnd_status->handle, kbuffer); - if (strlen(kbuffer) > 70) - kbuffer[0] = 0; } break; }