Skip to content

Commit 5b5d636

Browse files
Ayush1325aescolar
authored andcommitted
net: l2: ieee802154: shell: Fix stringop-truncation
- Fix the warning stringop-truncation - Leave space for NULL terminator. Signed-off-by: Ayush Singh <[email protected]>
1 parent d8f3bfa commit 5b5d636

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/l2/ieee802154/ieee802154_shell.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static int cmd_ieee802154_associate(const struct shell *sh,
7979
size_t argc, char *argv[])
8080
{
8181
struct net_if *iface = net_if_get_ieee802154();
82-
char ext_addr[EXT_ADDR_STR_SIZE];
82+
char ext_addr[EXT_ADDR_STR_SIZE] = {0};
8383

8484
if (argc < 3) {
8585
shell_help(sh);
@@ -99,7 +99,7 @@ static int cmd_ieee802154_associate(const struct shell *sh,
9999

100100
params = (struct ieee802154_req_params){0};
101101
params.pan_id = atoi(argv[1]);
102-
strncpy(ext_addr, argv[2], sizeof(ext_addr));
102+
strncpy(ext_addr, argv[2], EXT_ADDR_STR_LEN);
103103

104104
if (strlen(ext_addr) == EXT_ADDR_STR_LEN) {
105105
if (parse_extended_address(ext_addr, params.addr) < 0) {

0 commit comments

Comments
 (0)