Search Linux Wireless

Re: [PATCH v2 1/1] iw: add support for retrieving keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-01-02 at 12:12 +0100, Raphaël Mélotte wrote:
> 
> +	/* key index */
> +	if (argc) {
> +		nla_put_u8(msg, NL80211_ATTR_KEY_IDX, strtoul(argv[0], &end, 10));

This is odd now - if you have &end you should check that strtoul()
actually consumed all the input etc.? Otherwise might as well just use
atoi(), but I'd prefer with the checks.

> +		argv++;
> +		argc--;
> +	}
> +
> +	/* mac */
> +	if (argc) {
> +		if (mac_addr_a2n(mac, argv[0]) == 0) {
> +			NLA_PUT(msg, NL80211_ATTR_MAC, 6, mac);
> +			argv++;
> +			argc--;
> +			nla_put_u32(msg, NL80211_ATTR_KEY_TYPE, NL80211_KEYTYPE_PAIRWISE);

maybe add that before the argv/argc (and maybe break line in there) -
first I got concerned if argv/argc was used in that nla_put_u32().

johannes




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux