svn commit: r223940 - head/usr.bin/wall
David E. O'Brien
obrien at FreeBSD.org
Tue Jul 12 00:31:12 UTC 2011
Author: obrien
Date: Tue Jul 12 00:31:11 2011
New Revision: 223940
URL: http://svn.freebsd.org/changeset/base/223940
Log:
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.
Modified:
head/usr.bin/wall/wall.c
Modified: head/usr.bin/wall/wall.c
==============================================================================
--- head/usr.bin/wall/wall.c Mon Jul 11 22:01:39 2011 (r223939)
+++ head/usr.bin/wall/wall.c Tue Jul 12 00:31:11 2011 (r223940)
@@ -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;
More information about the svn-src-all
mailing list