wireless: airo: potential buffer overflow in sprintf()
[ Upstream commit 3d39e1bb1c88f32820c5f9271f2c8c2fb9a52bac ]
It looks like we wanted to print a maximum of BSSList_rid.ssidLen bytes
of the ssid, but we accidentally use "%*s" (width) instead of "%.*s"
(precision) so if the ssid doesn't have a NUL terminator this could lead
to an overflow.
Static analysis. Not tested.
Fixes: e174961ca1
("net: convert print_mac to %pM")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
46605d80ec
commit
574161e0d9
1 changed files with 1 additions and 1 deletions
|
@ -5484,7 +5484,7 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
|
||||||
we have to add a spin lock... */
|
we have to add a spin lock... */
|
||||||
rc = readBSSListRid(ai, doLoseSync, &BSSList_rid);
|
rc = readBSSListRid(ai, doLoseSync, &BSSList_rid);
|
||||||
while(rc == 0 && BSSList_rid.index != cpu_to_le16(0xffff)) {
|
while(rc == 0 && BSSList_rid.index != cpu_to_le16(0xffff)) {
|
||||||
ptr += sprintf(ptr, "%pM %*s rssi = %d",
|
ptr += sprintf(ptr, "%pM %.*s rssi = %d",
|
||||||
BSSList_rid.bssid,
|
BSSList_rid.bssid,
|
||||||
(int)BSSList_rid.ssidLen,
|
(int)BSSList_rid.ssidLen,
|
||||||
BSSList_rid.ssid,
|
BSSList_rid.ssid,
|
||||||
|
|
Loading…
Add table
Reference in a new issue