Skip to contentSkip to conversation

usb: gadget: tcm_usb_gadget: stop format strings

PATCH New Kees Cook 1 participant 1 message Mar 12, 2014 USB

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v2 1/1 usb: gadget: tcm_usb_gadget: stop format strings

This makes sure that the name coming out of configfs cannot be used accidentally as a format string.

---
v2:
- with stable cc; Felipe Balbi.

---
 drivers/usb/gadget/tcm_usb_gadget.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/tcm_usb_gadget.c +1 -1
index 0f8aad78b54f..460c266b8e24 100644
@@ -1613,7 +1613,7 @@ static struct se_wwn *usbg_make_tport(
 		return ERR_PTR(-ENOMEM);
 	}
 	tport->tport_wwpn = wwpn;
-	snprintf(tport->tport_name, sizeof(tport->tport_name), wnn_name);
+	snprintf(tport->tport_name, sizeof(tport->tport_name), "%s", wnn_name);
 	return &tport->tport_wwn;
 }
 
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security