diff options
Diffstat (limited to 'usr.bin/cdio')
-rw-r--r-- | usr.bin/cdio/cdio.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c index 1bce609c29d..3c98593ec53 100644 --- a/usr.bin/cdio/cdio.c +++ b/usr.bin/cdio/cdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdio.c,v 1.28 2003/02/18 09:42:33 jmc Exp $ */ +/* $OpenBSD: cdio.c,v 1.29 2003/04/06 20:50:05 krw Exp $ */ /* Copyright (c) 1995 Serge V. Vakulenko * All rights reserved. @@ -263,18 +263,14 @@ main(int argc, char **argv) int len; for (p=buf; argc-->0; ++argv) { - len = strlen(*argv); + len = snprintf(p, buf + sizeof buf - p, + "%s%s", (p > buf) ? " " : "", *argv); - if (p + len >= buf + sizeof (buf) - 1) - usage(); + if (len >= buf + sizeof buf - p) + errx(1, "argument list too long."); - if (p > buf) - *p++ = ' '; - - strcpy(p, *argv); /* ok */ p += len; } - *p = 0; arg = parse(buf, &cmd); return (run(cmd, arg)); } |