shell: Fix potential overwrite when using strncpy
Size argument must be smaller than strTo buffer size since strncpy terminates string with NULL. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
113b80ff0d
commit
6b31d67c6d
1 changed files with 1 additions and 1 deletions
|
@ -440,7 +440,7 @@ static u16_t common_beginning_find(const struct shell *shell,
|
||||||
shell_cmd_get(shell, cmd ? cmd->subcmd : NULL, cmd ? 1 : 0,
|
shell_cmd_get(shell, cmd ? cmd->subcmd : NULL, cmd ? 1 : 0,
|
||||||
first, &match, &dynamic_entry);
|
first, &match, &dynamic_entry);
|
||||||
strncpy(shell->ctx->temp_buff, match->syntax,
|
strncpy(shell->ctx->temp_buff, match->syntax,
|
||||||
sizeof(shell->ctx->temp_buff));
|
sizeof(shell->ctx->temp_buff) - 1);
|
||||||
|
|
||||||
*str = match->syntax;
|
*str = match->syntax;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue