Search Linux Wireless

[PATCH] Wireless: Make cfg80211_dev_rename() check sscanf return value in net/wireless/core.c

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

 



Make cfg80211_dev_rename() check sscanf return value.

Signed-off-by: Zhitong Wang <zhitong.wangzt@xxxxxxxxxxxxxxx>

---
 net/wireless/core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 80afacd..8e815b4 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -146,7 +146,9 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
 	int idx, taken = -1, result, digits;
 
 	/* prohibit calling the thing phy%d when %d is not its number */
-	sscanf(newname, PHY_NAME "%d%n", &idx, &taken);
+	if (sscanf(newname, PHY_NAME "%d%n", &idx, &taken) != 2)
+		return -EINVAL;
+
 	if (taken == strlen(newname) && idx != rdev->idx) {
 		/* count number of places needed to print idx */
 		digits = 1;
-- 
1.6.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux