kdb: Fix bound check compiler warning
authorWenlin Kang <wenlin.kang@windriver.com>
Mon, 13 May 2019 08:57:20 +0000 (16:57 +0800)
committerDaniel Thompson <daniel.thompson@linaro.org>
Tue, 14 May 2019 12:44:24 +0000 (13:44 +0100)
commitca976bfb3154c7bc67c4651ecd144fdf67ccaee7
treec14984408a43c210a00b4a24334a52f36462fccc
parentb586627e10f57ee3aa8f0cfab0d6f7dc4ae63760
kdb: Fix bound check compiler warning

The strncpy() function may leave the destination string buffer
unterminated, better use strscpy() instead.

This fixes the following warning with gcc 8.2:

kernel/debug/kdb/kdb_io.c: In function 'kdb_getstr':
kernel/debug/kdb/kdb_io.c:449:3: warning: 'strncpy' specified bound 256 equals destination size [-Wstringop-truncation]
   strncpy(kdb_prompt_str, prompt, CMD_BUFLEN);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_io.c