• Wenlin Kang's avatar
    kdb: Fix bound check compiler warning · ca976bfb
    Wenlin Kang authored
    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>
    ca976bfb
kdb_io.c 20.8 KB