diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2006-01-10 00:30:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2006-01-10 00:30:09 +0000 |
commit | 9c848b1ebf48348be6065e5205b98427552c65ac (patch) | |
tree | 52d75f511d88c63da7cf936aeb1dc51797c0a610 /usr.bin/xinstall | |
parent | e1018bf42f3da2fe58ef0e264fcfaf26363df88c (diff) |
Use strlcpy(), not strncpy(); OK deraadt@
Diffstat (limited to 'usr.bin/xinstall')
-rw-r--r-- | usr.bin/xinstall/xinstall.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index cac808ac8c5..c7417f65a61 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xinstall.c,v 1.42 2004/10/04 05:21:27 jsg Exp $ */ +/* $OpenBSD: xinstall.c,v 1.43 2006/01/10 00:30:08 millert Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #endif -static char rcsid[] = "$OpenBSD: xinstall.c,v 1.42 2004/10/04 05:21:27 jsg Exp $"; +static char rcsid[] = "$OpenBSD: xinstall.c,v 1.43 2006/01/10 00:30:08 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -615,14 +615,13 @@ create_tempfile(char *path, char *temp, size_t tsize) { char *p; - (void)strncpy(temp, path, tsize); - temp[tsize - 1] = '\0'; - if ((p = strrchr(temp, '/'))) + strlcpy(temp, path, tsize); + if ((p = strrchr(temp, '/')) != NULL) p++; else p = temp; - (void)strncpy(p, "INS@XXXXXXXXXX", &temp[tsize - 1] - p); - temp[tsize - 1] = '\0'; + *p = '\0'; + strlcat(p, "INS@XXXXXXXXXX", tsize); return(mkstemp(temp)); } |