From a76b14f093769b70c501ce0f8d0edc50396c3103 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 13 Mar 2003 22:26:53 +0000 Subject: Use strdup() instead of doing it by hand; deraadt@ OK --- usr.sbin/rtsold/rtsold.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c index 30b0a1ac41f..a961acc9107 100644 --- a/usr.sbin/rtsold/rtsold.c +++ b/usr.sbin/rtsold/rtsold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsold.c,v 1.27 2003/03/13 09:09:50 deraadt Exp $ */ +/* $OpenBSD: rtsold.c,v 1.28 2003/03/13 22:26:52 millert Exp $ */ /* $KAME: rtsold.c,v 1.57 2002/09/20 21:59:55 itojun Exp $ */ /* @@ -789,7 +789,7 @@ autoifprobe() static char **argv = NULL; static int n = 0; char **a; - int i, found, len; + int i, found; struct ifaddrs *ifap, *ifa, *target; /* initialize */ @@ -837,11 +837,8 @@ autoifprobe() if (a == NULL) err(1, "realloc"); argv = a; - len = 1 + strlen(ifa->ifa_name); - argv[n] = (char *)malloc(len); - if (!argv[n]) - err(1, "malloc"); - strlcpy(argv[n], ifa->ifa_name, len); + if ((argv[n] = strdup(ifa->ifa_name)) == NULL) + err(1, "strdup"); n++; } -- cgit v1.2.3