From owner-svn-src-all@FreeBSD.ORG Tue Jul 12 00:31:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C0C9106564A; Tue, 12 Jul 2011 00:31:12 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D0208FC25; Tue, 12 Jul 2011 00:31:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6C0VBsU015316; Tue, 12 Jul 2011 00:31:11 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6C0VB59015314; Tue, 12 Jul 2011 00:31:11 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201107120031.p6C0VB59015314@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 12 Jul 2011 00:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223940 - head/usr.bin/wall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2011 00:31:12 -0000 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;