diff options
author | 2003-04-05 16:13:47 +0000 | |
---|---|---|
committer | 2003-04-05 16:13:47 +0000 | |
commit | 233f00312f356bb4d8c5d357c6e61b92418a76fe (patch) | |
tree | 24196979f5c1024a5488323d74e1c2f57cb66d4c | |
parent | simple strlcpy; henning ok (diff) | |
download | wireguard-openbsd-233f00312f356bb4d8c5d357c6e61b92418a76fe.tar.xz wireguard-openbsd-233f00312f356bb4d8c5d357c6e61b92418a76fe.zip |
simple strcpy replacement; miod ok
-rw-r--r-- | usr.bin/hexdump/parse.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index a6a9e0b93c2..9f8ef807d34 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.10 2002/03/14 06:51:42 mpech Exp $ */ +/* $OpenBSD: parse.c,v 1.11 2003/04/05 16:13:47 deraadt Exp $ */ /* $NetBSD: parse.c,v 1.12 2001/12/07 13:37:39 bjh21 Exp $ */ /* @@ -36,7 +36,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)parse.c 5.6 (Berkeley) 3/9/91";*/ -static char rcsid[] = "$OpenBSD: parse.c,v 1.10 2002/03/14 06:51:42 mpech Exp $"; +static char rcsid[] = "$OpenBSD: parse.c,v 1.11 2003/04/05 16:13:47 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -219,6 +219,7 @@ rewrite(fs) char *p1, *p2; char savech, *fmtp, cs[3]; int nconv, prec; + size_t len; nextpr = NULL; prec = 0; @@ -396,9 +397,9 @@ isint2: switch(fu->bcnt) { */ savech = *p2; p1[0] = '\0'; - pr->fmt = emalloc(strlen(fmtp) + strlen(cs) + 1); - (void)strcpy(pr->fmt, fmtp); - (void)strcat(pr->fmt, cs); + len = strlen(fmtp) + strlen(cs) + 1; + pr->fmt = emalloc(len); + snprintf(pr->fmt, len, "%s%s", fmtp, cs); *p2 = savech; pr->cchar = pr->fmt + (p1 - fmtp); fmtp = p2; |