usb: gadget: tcm_usb_gadget: stop format strings
PATCH 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.
Signed-off-by Kees Cook <[email protected]>
--- drivers/usb/gadget/tcm_usb_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/tcm_usb_gadget.c +1 -1
@@ -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
Quoted 13 lines · Kees Cook
This makes sure that the name coming out of configfs cannot be used accidentally as a format string.
Signed-off-by Kees Cook <[email protected]>--- drivers/usb/gadget/tcm_usb_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/gadget/tcm_usb_gadget.c +0
-0
drivers/usb/gadget/tcm_usb_gadget.c static struct se_wwn *usbg_make_tport( · line 1616
Quoted 5 lines
drivers/usb/gadget/tcm_usb_gadget.c +1
-1@@ -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);
Can you resend with Cc: <[email protected]> ?
Looks like we need to backport this v3.4.
Signature · 1 line
balbi