diff options
author | obrien <obrien@FreeBSD.org> | 2011-07-12 00:31:11 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2011-07-12 00:31:11 +0000 |
commit | 003e9442e5b42e94fba8f115dcb5540d4edbc877 (patch) | |
tree | 96742a5c32c3916fd8a10110ad29cdadac605181 /usr.bin | |
parent | f0609ad12f01082fe209518d41d5a83ffb67d7b7 (diff) | |
download | FreeBSD-src-003e9442e5b42e94fba8f115dcb5540d4edbc877.zip FreeBSD-src-003e9442e5b42e94fba8f115dcb5540d4edbc877.tar.gz |
If one's message is longer than the buffer size, then we reset 'cnt' at the
wrong point and the actual column # get out of sync across the buffer size.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/wall/wall.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c index 5c44749..eea253f 100644 --- a/usr.bin/wall/wall.c +++ b/usr.bin/wall/wall.c @@ -239,8 +239,9 @@ makemsg(char *fname) err(1, "can't read %s", fname); setegid(egid); } + cnt = 0; while (fgets(lbuf, sizeof(lbuf), stdin)) { - for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { + for (p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { if (ch == '\r') { putc('\r', fp); cnt = 0; |