Skip to content

Commit 5b26f1a

Browse files
tobluxdaniel-thompson
authored andcommitted
kdb: Replace deprecated strcpy() with memcpy() in parse_grep()
strcpy() is deprecated; use memcpy() instead. We can safely use memcpy() because we already know the length of the source string 'cp' and that it is guaranteed to be NUL-terminated within the first KDB_GREP_STRLEN bytes. Link: KSPP#88 Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Daniel Thompson (RISCstar) <danielt@kernel.org>
1 parent 8790cc2 commit 5b26f1a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/debug/kdb/kdb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static void parse_grep(const char *str)
860860
kdb_printf("search string too long\n");
861861
return;
862862
}
863-
strcpy(kdb_grep_string, cp);
863+
memcpy(kdb_grep_string, cp, len + 1);
864864
kdb_grepping_flag++;
865865
return;
866866
}

0 commit comments

Comments
 (0)