Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys appease coverity by using strlcpy instead of strncpy
details: https://anonhg.NetBSD.org/src/rev/674c5817b4f2
branches: trunk
changeset: 350612:674c5817b4f2
user: maya <maya%NetBSD.org@localhost>
date: Sat Jan 14 16:34:44 2017 +0000
description:
appease coverity by using strlcpy instead of strncpy
ok riastradh
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 12 ++++++------
sys/net/if_srt.c | 8 ++++----
sys/net80211/ieee80211_netbsd.c | 6 +++---
3 files changed, 13 insertions(+), 13 deletions(-)
diffs (113 lines):
diff -r 9130332caed7 -r 674c5817b4f2 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Sat Jan 14 16:21:28 2017 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Sat Jan 14 16:34:44 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.88 2016/12/26 23:05:06 christos Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.88 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -335,7 +335,7 @@
netbsd32_to_ieee80211req(struct netbsd32_ieee80211req *ireq32,
struct ieee80211req *ireq, u_long cmd)
{
- strncpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
+ strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
ireq->i_type = ireq32->i_type;
ireq->i_val = ireq32->i_val;
ireq->i_len = ireq32->i_len;
@@ -349,7 +349,7 @@
{
int i;
- strncpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
+ strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
nwk->i_wepon = nwk32->i_wepon;
nwk->i_defkid = nwk32->i_defkid;
for (i = 0; i < IEEE80211_WEP_NKID; i++) {
@@ -758,7 +758,7 @@
netbsd32_from_ieee80211req(struct ieee80211req *ireq,
struct netbsd32_ieee80211req *ireq32, u_long cmd)
{
- strncpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
+ strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
ireq32->i_type = ireq->i_type;
ireq32->i_val = ireq->i_val;
ireq32->i_len = ireq->i_len;
@@ -772,7 +772,7 @@
{
int i;
- strncpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
+ strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
nwk32->i_wepon = nwk->i_wepon;
nwk32->i_defkid = nwk->i_defkid;
for (i = 0; i < IEEE80211_WEP_NKID; i++) {
diff -r 9130332caed7 -r 674c5817b4f2 sys/net/if_srt.c
--- a/sys/net/if_srt.c Sat Jan 14 16:21:28 2017 +0000
+++ b/sys/net/if_srt.c Sat Jan 14 16:34:44 2017 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.23 2016/08/07 17:38:34 christos Exp $ */
+/* $NetBSD: if_srt.c,v 1.24 2017/01/14 16:34:44 maya Exp $ */
/* This file is in the public domain. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.23 2016/08/07 17:38:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.24 2017/01/14 16:34:44 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -402,7 +402,7 @@
dr->af = scr->af;
dr->srcmatch = scr->srcmatch;
dr->srcmask = scr->srcmask;
- strncpy(&dr->u.dstifn[0],&scr->u.dstifp->if_xname[0],IFNAMSIZ);
+ strlcpy(&dr->u.dstifn[0],&scr->u.dstifp->if_xname[0],IFNAMSIZ);
memcpy(&dr->dst,&scr->dst,scr->dst.sa.sa_len);
return 0;
case SRT_SETRT:
@@ -411,7 +411,7 @@
dr = (struct srt_rt *) data;
if (dr->inx > sc->nrt)
return EDOM;
- strncpy(&nbuf[0],&dr->u.dstifn[0],IFNAMSIZ);
+ strlcpy(&nbuf[0],&dr->u.dstifn[0],IFNAMSIZ);
nbuf[IFNAMSIZ-1] = '\0';
if (dr->dst.sa.sa_family != dr->af)
return EIO;
diff -r 9130332caed7 -r 674c5817b4f2 sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c Sat Jan 14 16:21:28 2017 +0000
+++ b/sys/net80211/ieee80211_netbsd.c Sat Jan 14 16:34:44 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_netbsd.c,v 1.28 2016/09/27 20:20:06 christos Exp $ */
+/* $NetBSD: ieee80211_netbsd.c,v 1.29 2017/01/14 16:34:44 maya Exp $ */
/*-
* Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
* All rights reserved.
@@ -30,7 +30,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $");
#else
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.28 2016/09/27 20:20:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.29 2017/01/14 16:34:44 maya Exp $");
#endif
/*
@@ -139,7 +139,7 @@
node = *rnode;
ic = node.sysctl_data;
- strncpy(pname, ic->ic_ifp->if_xname, IFNAMSIZ);
+ strlcpy(pname, ic->ic_ifp->if_xname, IFNAMSIZ);
node.sysctl_data = pname;
return sysctl_lookup(SYSCTLFN_CALL(&node));
}
Home |
Main Index |
Thread Index |
Old Index