From 284e9bd2d03fff96431b23f45467c4b2ca5320e0 Mon Sep 17 00:00:00 2001 From: itojun Date: Thu, 22 Aug 2002 07:18:42 +0000 Subject: [PATCH] string manipulation fixes. from openbsd --- common/device.c | 6 +++--- common/pf.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/device.c b/common/device.c index 763aa27..f27098f 100644 --- a/common/device.c +++ b/common/device.c @@ -1,4 +1,4 @@ -/* $NetBSD: device.c,v 1.4 2002/07/13 11:35:35 itojun Exp $ */ +/* $NetBSD: device.c,v 1.5 2002/08/22 07:18:42 itojun Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: device.c,v 1.4 2002/07/13 11:35:35 itojun Exp $"); +__RCSID("$NetBSD: device.c,v 1.5 2002/08/22 07:18:42 itojun Exp $"); #endif #include "os.h" @@ -105,7 +105,7 @@ deviceOpen(ifname, proto, trans) { struct if_info *p, tmp; - strcpy(tmp.if_name,ifname); + strlcpy(tmp.if_name, ifname, sizeof(tmp.if_name)); tmp.iopen = pfInit; switch (proto) { diff --git a/common/pf.c b/common/pf.c index 8155239..2faa13d 100644 --- a/common/pf.c +++ b/common/pf.c @@ -1,4 +1,4 @@ -/* $NetBSD: pf.c,v 1.6 2002/07/13 11:35:35 itojun Exp $ */ +/* $NetBSD: pf.c,v 1.7 2002/08/22 07:18:42 itojun Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -35,7 +35,7 @@ #include #ifndef lint -__RCSID("$NetBSD: pf.c,v 1.6 2002/07/13 11:35:35 itojun Exp $"); +__RCSID("$NetBSD: pf.c,v 1.7 2002/08/22 07:18:42 itojun Exp $"); #endif #include "os.h" @@ -159,7 +159,7 @@ pfAddMulti(s, interface, addr) struct ifreq ifr; int fd; - strcpy(ifr.ifr_name, interface); + strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name)); ifr.ifr_addr.sa_family = AF_UNSPEC; memmove(ifr.ifr_addr.sa_data, addr, 6); @@ -194,7 +194,7 @@ pfDelMulti(s, interface, addr) struct ifreq ifr; int fd; - strcpy(ifr.ifr_name, interface); + strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name)); ifr.ifr_addr.sa_family = AF_UNSPEC; memmove(ifr.ifr_addr.sa_data, addr, 6);