From da4b035c00c91f83f53006859ff51cc6316c59fd Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 29 May 2002 18:39:01 +0000 Subject: more strlcat and strlcpy --- usr.sbin/rbootd/bpf.c | 6 +++--- usr.sbin/rbootd/utils.c | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'usr.sbin/rbootd') diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c index a0c6f7aad9a..f016ed12090 100644 --- a/usr.sbin/rbootd/bpf.c +++ b/usr.sbin/rbootd/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.9 2002/05/29 09:45:08 deraadt Exp $ */ +/* $OpenBSD: bpf.c,v 1.10 2002/05/29 18:39:00 deraadt Exp $ */ /* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */ /* @@ -49,7 +49,7 @@ #ifndef lint /*static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$OpenBSD: bpf.c,v 1.9 2002/05/29 09:45:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: bpf.c,v 1.10 2002/05/29 18:39:00 deraadt Exp $"; #endif /* not lint */ #include @@ -297,7 +297,7 @@ BpfGetIntfName(errmsg) return(NULL); } - (void) strcpy(device, mp->ifr_name); + (void) strlcpy(device, mp->ifr_name, sizeof device); return(device); } diff --git a/usr.sbin/rbootd/utils.c b/usr.sbin/rbootd/utils.c index ad8c0d14c18..327073f7e45 100644 --- a/usr.sbin/rbootd/utils.c +++ b/usr.sbin/rbootd/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.5 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: utils.c,v 1.6 2002/05/29 18:39:00 deraadt Exp $ */ /* $NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $ */ /* @@ -49,7 +49,7 @@ #ifndef lint /*static char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$OpenBSD: utils.c,v 1.5 2002/03/14 16:44:25 mpech Exp $"; +static char rcsid[] = "$OpenBSD: utils.c,v 1.6 2002/05/29 18:39:00 deraadt Exp $"; #endif /* not lint */ #include @@ -338,12 +338,11 @@ NewStr(str) { char *stmp; - if ((stmp = (char *)malloc((unsigned) (strlen(str)+1))) == NULL) { + stmp = strdup(str); + if (stmp == NULL) { syslog(LOG_ERR, "NewStr: out of memory (%s)", str); return(NULL); } - - (void) strcpy(stmp, str); return(stmp); } -- cgit v1.2.3