From: Kees Cook Date: Tue, 11 Mar 2014 20:26:16 +0000 (-0700) Subject: usb: gadget: tcm_usb_gadget: stop format strings X-Git-Tag: firefly_0821_release~176^2~4191^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aba37fd975f0dd58e025c99c2a79b61b20190831;p=firefly-linux-kernel-4.4.55.git 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 Cc: stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c index 0f8aad78b54f..460c266b8e24 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.c +++ b/drivers/usb/gadget/tcm_usb_gadget.c @@ -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; }