make coverity understand that there is no buffer overflow here.

This commit is contained in:
Enno Rehling 2020-06-27 17:40:18 +02:00
parent d6b57fc818
commit 15f2e014d2
1 changed files with 2 additions and 4 deletions

View File

@ -1514,14 +1514,12 @@ static void handlekey(state * st, int c)
} }
if (wnd == NULL) { if (wnd == NULL) {
static char kbuffer[80]; static char kbuffer[80];
if (kbuffer[0] == 0) { if (kbuffer[0] == 0 || strlen(kbuffer) > 70) {
strcpy(kbuffer, "getch:"); strcpy(kbuffer, "getch:");
} }
sprintf(sbuffer, " 0x%x", c); snprintf(sbuffer, 10, " 0x%x", c);
strncat(kbuffer, sbuffer, sizeof(kbuffer) - 1); strncat(kbuffer, sbuffer, sizeof(kbuffer) - 1);
statusline(st->wnd_status->handle, kbuffer); statusline(st->wnd_status->handle, kbuffer);
if (strlen(kbuffer) > 70)
kbuffer[0] = 0;
} }
break; break;
} }