Skip to content

Commit 0cfd963

Browse files
jukkarnashif
authored andcommitted
net: wifi: shell: Avoid using sscanf
The sscanf() is not available for minimal libc so it cannot be used. Use the net_bytes_from_str() that is provided for this purposes. Fixes #75029 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 5343ae6 commit 0cfd963

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,11 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
567567
params->mfp = atoi(optarg);
568568
break;
569569
case 'm':
570-
sscanf(optarg, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
571-
&params->bssid[0], &params->bssid[1],
572-
&params->bssid[2], &params->bssid[3],
573-
&params->bssid[4], &params->bssid[5]);
570+
if (net_bytes_from_str(params->bssid, sizeof(params->bssid),
571+
optarg) < 0) {
572+
PR_WARNING("Invalid MAC address\n");
573+
return -EINVAL;
574+
}
574575
break;
575576
case 't':
576577
if (iface_mode == WIFI_MODE_INFRA) {

0 commit comments

Comments
 (0)