diff options
author | Matthew N. Dodd <mdodd@FreeBSD.org> | 1999-08-20 01:24:35 +0000 |
---|---|---|
committer | Matthew N. Dodd <mdodd@FreeBSD.org> | 1999-08-20 01:24:35 +0000 |
commit | 0b2d7c2ffc8249404106189cd735065ff2c49409 (patch) | |
tree | f2fef48a1b87c4fff1eecbfa0d346b45b6701f42 /usr.sbin/cdcontrol | |
parent | 90cc1fbc53153f0c7175c41720a40fd543a55bca (diff) | |
download | src-test2-0b2d7c2ffc8249404106189cd735065ff2c49409.tar.gz src-test2-0b2d7c2ffc8249404106189cd735065ff2c49409.zip |
Notes
Diffstat (limited to 'usr.sbin/cdcontrol')
-rw-r--r-- | usr.sbin/cdcontrol/cdcontrol.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index 539cf52bad88..ed4f433ea57f 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -20,7 +20,7 @@ #ifndef lint static const char rcsid[] = - "$Id: cdcontrol.c,v 1.19 1999/08/19 03:29:11 mdodd Exp $"; + "$Id: cdcontrol.c,v 1.20 1999/08/19 04:10:31 mdodd Exp $"; #endif /* not lint */ #include <ctype.h> @@ -937,6 +937,7 @@ input (int *cmd) static History *hist = NULL; static char buf[MAXLINE]; int num = 0; + int len; const char *bp = NULL; char *p; @@ -955,8 +956,9 @@ input (int *cmd) if ((bp = el_gets(el, &num)) == NULL || num == 0) return (0); - memcpy(buf, bp, (MAXLINE > num ? MAXLINE : num)); - buf[num] = 0; + len = (num > MAXLINE) ? MAXLINE : num; + memcpy(buf, bp, len); + buf[len] = 0; history(hist, H_ENTER, bp); #undef MAXLINE |