usb: gadget: tcm_usb_gadget: stop format strings
authorKees Cook <keescook@chromium.org>
Tue, 11 Mar 2014 20:26:16 +0000 (13:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:59:30 +0000 (07:59 -0700)
commit aba37fd975f0dd58e025c99c2a79b61b20190831 upstream.

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

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/tcm_usb_gadget.c

index 0f8aad7..460c266 100644 (file)
@@ -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;
 }