Messages in this thread | | | Date | Tue, 16 Sep 2014 16:09:32 +0200 | From | Marc Kleine-Budde <> | Subject | Re: [PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up missing null-terminate in conjunction with strncpy |
| |
On 09/14/2014 07:31 PM, Rickard Strandqvist wrote: > Replacing strncpy with strlcpy to avoid strings that lacks null terminate. > > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> > --- > drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c > index 644e6ab..d4fe8ac 100644 > --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c > +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c > @@ -830,7 +830,7 @@ static void peak_usb_disconnect(struct usb_interface *intf) > char name[IFNAMSIZ]; > > dev->state &= ~PCAN_USB_STATE_CONNECTED; > - strncpy(name, netdev->name, IFNAMSIZ); > + strlcpy(name, netdev->name, IFNAMSIZ); > > unregister_netdev(netdev); > free_candev(netdev); >
What about removing the dev_info(), the name array and the str?cpy() completely?
Marc
-- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[unhandled content-type:application/pgp-signature] | |