From 55b664b58fbd8ae25d4dbee40fe9e0c4e25a187c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 23 Feb 2020 21:57:50 +0100 Subject: [PATCH] Fix possible bufferoverflow with strncpy --- stm-firmware/shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stm-firmware/shell.c b/stm-firmware/shell.c index 4da429d..a34f0b7 100644 --- a/stm-firmware/shell.c +++ b/stm-firmware/shell.c @@ -93,7 +93,8 @@ static shellmatta_retCode_t shell_cmd_digio_set(const shellmatta_handle_t hand char buff[64]; char *curr_token; - strncpy(buff, arguments, sizeof(buff)); + strncpy(buff, arguments, sizeof(buff)-1); + buff[63] = '\0'; curr_token = strtok(buff, " "); curr_token = strtok(NULL, " ");