Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2011 00:31:11 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r223940 - head/usr.bin/wall
Message-ID:  <201107120031.p6C0VB59015314@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107120031.p6C0VB59015314>