diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-13 22:26:53 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-13 22:26:53 +0000 |
commit | a76b14f093769b70c501ce0f8d0edc50396c3103 (patch) | |
tree | ac5636915a756a8dc99a7c05cc898e211b6072b9 | |
parent | 14a08e5ed5cb4134c808a91838edfc3aaab79a3d (diff) |
Use strdup() instead of doing it by hand; deraadt@ OK
-rw-r--r-- | usr.sbin/rtsold/rtsold.c | 11 |
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++; } |