summaryrefslogtreecommitdiff
path: root/kernel/debug
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-04-22 19:33:42 +0300
committerDaniel Thompson <daniel.thompson@linaro.org>2019-05-02 15:40:27 +0300
commit4cc168eaf3b67d76547fb420c22abe22a3c86003 (patch)
tree7b91471f46b196867f6c5c195c63510eb6879b9e /kernel/debug
parenta5d5092c9285f6c8937b56f9c6ff2b22d818fc25 (diff)
downloadlinux-4cc168eaf3b67d76547fb420c22abe22a3c86003.tar.xz
gdbstub: Replace strcpy() by strscpy()
The strcpy() function is being deprecated. Replace it by the safer strscpy() and fix the following Coverity warning: "You might overrun the 1024-character fixed-size string remcom_in_buffer by copying cmd without checking the length." Addresses-Coverity-ID: 138999 ("Copy into fixed size buffer") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/gdbstub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 9f267b8905b4..4b280fc7dd67 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -1095,10 +1095,10 @@ int gdbstub_state(struct kgdb_state *ks, char *cmd)
return error;
case 's':
case 'c':
- strcpy(remcom_in_buffer, cmd);
+ strscpy(remcom_in_buffer, cmd, sizeof(remcom_in_buffer));
return 0;
case '$':
- strcpy(remcom_in_buffer, cmd);
+ strscpy(remcom_in_buffer, cmd, sizeof(remcom_in_buffer));
gdbstub_use_prev_in_buf = strlen(remcom_in_buffer);
gdbstub_prev_in_buf_pos = 0;
return 0;