diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-05 16:06:02 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-05 16:06:02 +0000 |
commit | 19a2c59b39fd1bceda65f5a6a57c47bcb8d8e675 (patch) | |
tree | fd064ffa19a9a28265010fb1a99652dad0f6d16b /usr.sbin | |
parent | a1eb4be12da9344b632762f820ef148712c4dd29 (diff) |
correct a bad strncpy; replace with strlcat; rohee@ ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/lib/str.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c index 1d8518c61e5..f6294699b7c 100644 --- a/usr.sbin/pkg_install/lib/str.c +++ b/usr.sbin/pkg_install/lib/str.c @@ -1,7 +1,7 @@ -/* $OpenBSD: str.c,v 1.8 2003/04/05 10:42:19 avsm Exp $ */ +/* $OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: str.c,v 1.8 2003/04/05 10:42:19 avsm Exp $"; +static const char *rcsid = "$OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $"; #endif /* @@ -66,10 +66,9 @@ strconcat(char *s1, char *s2) { static char tmp[FILENAME_MAX]; - tmp[0] = '\0'; - strncpy(tmp, s1 ? s1 : s2, FILENAME_MAX); + strlcpy(tmp, s1 ? s1 : s2, sizeof(tmp)); if (s1 && s2) - strncat(tmp, s2, FILENAME_MAX - strlen(tmp)); + strlcat(tmp, s2, sizeof(tmp)); return tmp; } |