1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

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.
This commit is contained in:
David E. O'Brien 2011-07-12 00:31:11 +00:00
parent fcc2fa496d
commit b0023655af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223940

View File

@ -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;