riscv: KGDB: Replace deprecated strcpy in kgdb_arch_handle_qxfer_pkt
PATCH 1/1 riscv: KGDB: Replace deprecated strcpy in kgdb_arch_handle_qxfer_pkt
strcpy() is deprecated because it can cause a buffer overflow when the sizes of the source and the destination are not known at compile time. Use strscpy() instead.
Signed-off-by Thorsten Blum <[email protected]>
--- arch/riscv/kernel/kgdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/kgdb.c +2 -2
@@ -265,10 +265,10 @@ void kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer, {if (!strncmp (remcom_in_buffer, gdb_xfer_read_target,sizeof (gdb_xfer_read_target))) -strcpy (remcom_out_buffer, riscv_gdb_stub_target_desc); +strscpy (remcom_out_buffer, riscv_gdb_stub_target_desc,BUFMAX );else if (!strncmp (remcom_in_buffer, gdb_xfer_read_cpuxml,sizeof (gdb_xfer_read_cpuxml))) -strcpy (remcom_out_buffer, riscv_gdb_stub_cpuxml); +strscpy (remcom_out_buffer, riscv_gdb_stub_cpuxml,BUFMAX ); } static inline void kgdb_arch_update_addr(struct pt_regs *regs,
Signature · 1 line
2.51.0
Paul Walmsley
maintainerQuoted 6 lines · Thorsten Blum
strcpy()is deprecated because it can cause a buffer overflow when the sizes of the source and the destination are not known at compile time. Usestrscpy()instead.Signed-off-by Thorsten Blum <[email protected]>
Thanks, queued for v6.18-rc fixes.
- Paul