Skip to content

Commit

Permalink
net: l2: ieee802154: shell: Fix stringop-truncation
Browse files Browse the repository at this point in the history
- Fix the warning stringop-truncation
- Leave space for NULL terminator.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
  • Loading branch information
Ayush1325 authored and aescolar committed Oct 9, 2024
1 parent d8f3bfa commit 5b5d636
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/l2/ieee802154/ieee802154_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int cmd_ieee802154_associate(const struct shell *sh,
size_t argc, char *argv[])
{
struct net_if *iface = net_if_get_ieee802154();
char ext_addr[EXT_ADDR_STR_SIZE];
char ext_addr[EXT_ADDR_STR_SIZE] = {0};

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

params = (struct ieee802154_req_params){0};
params.pan_id = atoi(argv[1]);
strncpy(ext_addr, argv[2], sizeof(ext_addr));
strncpy(ext_addr, argv[2], EXT_ADDR_STR_LEN);

if (strlen(ext_addr) == EXT_ADDR_STR_LEN) {
if (parse_extended_address(ext_addr, params.addr) < 0) {
Expand Down

0 comments on commit 5b5d636

Please sign in to comment.