From: Richard M. Stallman Date: Sun, 15 May 1994 19:38:50 +0000 (+0000) Subject: (crlf_to_lf): Fix off-by-one condition. X-Git-Tag: emacs-19.34~8346 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d4ad6e0a35eab9dbf0b1725542b57f2b03c0c78;p=emacs.git (crlf_to_lf): Fix off-by-one condition. --- diff --git a/src/msdos.c b/src/msdos.c index ad7d8b4e478..eb95a800767 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -471,7 +471,7 @@ crlf_to_lf (n, buf) if (n == 0) return n; - while (buf < endp) + while (buf < endp - 1) { if (*buf == 0x0d) { @@ -481,6 +481,8 @@ crlf_to_lf (n, buf) else *np++ = *buf++; } + if (buf < endp) + *np++ = *buf++; return np - startp; }