Fix possible bufferoverflow with strncpy

This commit is contained in:
Mario Hüttel 2020-02-23 21:57:50 +01:00
parent fcbd1ae05e
commit 55b664b58f

View File

@ -93,7 +93,8 @@ static shellmatta_retCode_t shell_cmd_digio_set(const shellmatta_handle_t hand
char buff[64]; char buff[64];
char *curr_token; char *curr_token;
strncpy(buff, arguments, sizeof(buff)); strncpy(buff, arguments, sizeof(buff)-1);
buff[63] = '\0';
curr_token = strtok(buff, " "); curr_token = strtok(buff, " ");
curr_token = strtok(NULL, " "); curr_token = strtok(NULL, " ");