summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-05 16:17:26 +0000
committerderaadt <deraadt@openbsd.org>2003-04-05 16:17:26 +0000
commite3a2202684e67d2c91985b7b1120e15b4ffb6301 (patch)
tree2b39bddace7a1678834425755aa4ad848ab504d8
parentsimple strcpy replacement; miod ok (diff)
downloadwireguard-openbsd-e3a2202684e67d2c91985b7b1120e15b4ffb6301.tar.xz
wireguard-openbsd-e3a2202684e67d2c91985b7b1120e15b4ffb6301.zip
strlcpy whack; miod ok
-rw-r--r--usr.bin/uniq/uniq.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
index 6437e8bfc7c..cf87f41101f 100644
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uniq.c,v 1.12 2002/12/08 22:43:54 millert Exp $ */
+/* $OpenBSD: uniq.c,v 1.13 2003/04/05 16:17:26 deraadt Exp $ */
/* $NetBSD: uniq.c,v 1.7 1995/08/31 22:03:48 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)uniq.c 8.3 (Berkeley) 5/4/95";
#endif
-static char rcsid[] = "$OpenBSD: uniq.c,v 1.12 2002/12/08 22:43:54 millert Exp $";
+static char rcsid[] = "$OpenBSD: uniq.c,v 1.13 2003/04/05 16:17:26 deraadt Exp $";
#endif /* not lint */
#include <errno.h>
@@ -226,12 +226,12 @@ obsolete(char *argv[])
* Digit signifies an old-style option. Malloc space for dash,
* new option and argument.
*/
- len = strlen(ap);
- if ((start = p = malloc(len + 3)) == NULL)
+ len = strlen(ap) + 3;
+ if ((start = p = malloc(len)) == NULL)
err(1, "malloc");
*p++ = '-';
*p++ = ap[0] == '+' ? 's' : 'f';
- (void)strcpy(p, ap + 1);
+ (void)strlcpy(p, ap + 1, len - 2);
*argv = start;
}
}