summaryrefslogtreecommitdiff
path: root/usr.sbin/rtsold
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-13 22:26:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-13 22:26:53 +0000
commita76b14f093769b70c501ce0f8d0edc50396c3103 (patch)
treeac5636915a756a8dc99a7c05cc898e211b6072b9 /usr.sbin/rtsold
parent14a08e5ed5cb4134c808a91838edfc3aaab79a3d (diff)
Use strdup() instead of doing it by hand; deraadt@ OK
Diffstat (limited to 'usr.sbin/rtsold')
-rw-r--r--usr.sbin/rtsold/rtsold.c11
1 files changed, 4 insertions, 7 deletions
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++;
}