Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2527458f authored by Wenlin Kang's avatar Wenlin Kang Committed by Vegard Nossum
Browse files

kdb: Fix bound check compiler warning



[ Upstream commit ca976bfb3154c7bc67c4651ecd144fdf67ccaee7 ]

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: default avatarWenlin Kang <wenlin.kang@windriver.com>
Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Stable-dep-of: 70867efacf43 ("kdb: address -Wformat-security warnings")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit b15593e2904d2ff0094b7170f806dba0eeefac75)
Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
parent 0e318baa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment