Appease coverity which is having nightmares about strings not being

null-terminated by using strlcpy rather than strncpy when it doesn't
matter.

ok christos.
This commit is contained in:
maya 2017-01-12 18:26:08 +00:00
parent 585a07d820
commit f8d901fcdb
8 changed files with 24 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_aue.c,v 1.140 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_aue.c,v 1.141 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.140 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.141 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -836,7 +836,7 @@ aue_attach(device_t parent, device_t self, void *aux)
ifp->if_ioctl = aue_ioctl;
ifp->if_start = aue_start;
ifp->if_watchdog = aue_watchdog;
strncpy(ifp->if_xname, device_xname(sc->aue_dev), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(sc->aue_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_axe.c,v 1.79 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_axe.c,v 1.80 2017/01/12 18:26:08 maya Exp $ */
/* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
/*
@ -87,7 +87,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.79 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.80 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -988,7 +988,7 @@ axe_attach(device_t parent, device_t self, void *aux)
/* Initialize interface info.*/
ifp = &sc->sc_if;
ifp->if_softc = sc;
strncpy(ifp->if_xname, devname, IFNAMSIZ);
strlcpy(ifp->if_xname, devname, IFNAMSIZ);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = axe_ioctl;
ifp->if_start = axe_start;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cdce.c,v 1.43 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_cdce.c,v 1.44 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.43 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.44 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -281,7 +281,7 @@ cdce_attach(device_t parent, device_t self, void *aux)
ifp->if_ioctl = cdce_ioctl;
ifp->if_start = cdce_start;
ifp->if_watchdog = cdce_watchdog;
strncpy(ifp->if_xname, device_xname(sc->cdce_dev), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(sc->cdce_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cue.c,v 1.75 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_cue.c,v 1.76 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.75 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.76 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -542,7 +542,7 @@ cue_attach(device_t parent, device_t self, void *aux)
ifp->if_ioctl = cue_ioctl;
ifp->if_start = cue_start;
ifp->if_watchdog = cue_watchdog;
strncpy(ifp->if_xname, device_xname(sc->cue_dev), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(sc->cue_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_kue.c,v 1.88 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_kue.c,v 1.89 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.88 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.89 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -500,7 +500,7 @@ kue_attach(device_t parent, device_t self, void *aux)
ifp->if_ioctl = kue_ioctl;
ifp->if_start = kue_start;
ifp->if_watchdog = kue_watchdog;
strncpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_udav.c,v 1.50 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_udav.c,v 1.51 2017/01/12 18:26:08 maya Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.50 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.51 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -283,7 +283,7 @@ udav_attach(device_t parent, device_t self, void *aux)
ifp = GET_IFP(sc);
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = udav_start;
ifp->if_ioctl = udav_ioctl;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_upl.c,v 1.58 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.58 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -295,7 +295,7 @@ upl_attach(device_t parent, device_t self, void *aux)
ifp->if_ioctl = upl_ioctl;
ifp->if_start = upl_start;
ifp->if_watchdog = upl_watchdog;
strncpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
ifp->if_type = IFT_OTHER;
ifp->if_addrlen = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_url.c,v 1.55 2016/12/15 09:28:06 ozaki-r Exp $ */
/* $NetBSD: if_url.c,v 1.56 2017/01/12 18:26:08 maya Exp $ */
/*
* Copyright (c) 2001, 2002
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.55 2016/12/15 09:28:06 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.56 2017/01/12 18:26:08 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -277,7 +277,7 @@ url_attach(device_t parent, device_t self, void *aux)
ifp = GET_IFP(sc);
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = url_start;
ifp->if_ioctl = url_ioctl;