From: wzt.wzt@gmail.com
To: linux-kernel@vger.kernel.org
Cc: linux-wireless@vger.kernel.org, flamingice@sourmilk.net
Subject: [PATCH] Wireless: Make cfg80211_dev_rename() check sscanf return value in net/wireless/core.c
Date: Sat, 20 Mar 2010 12:53:52 +0800 [thread overview]
Message-ID: <20100320045352.GA2949@localhost.localdomain> (raw)
Make cfg80211_dev_rename() check sscanf return value.
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
---
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
next reply other threads:[~2010-03-20 4:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 4:53 wzt.wzt [this message]
2010-03-20 7:39 ` [PATCH] Wireless: Make cfg80211_dev_rename() check sscanf return value in net/wireless/core.c Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100320045352.GA2949@localhost.localdomain \
--to=wzt.wzt@gmail.com \
--cc=flamingice@sourmilk.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).