# HG changeset patch # User Richard M. Stallman # Date 769030730 0 # Node ID b393834bab2a6231a851b724509bd81c2cade144 # Parent 9fa47d36798a95b7d1ca44be4146943c8a7f0876 (crlf_to_lf): Fix off-by-one condition. diff -r 9fa47d36798a -r b393834bab2a src/msdos.c --- a/src/msdos.c Sun May 15 19:25:21 1994 +0000 +++ b/src/msdos.c Sun May 15 19:38:50 1994 +0000 @@ -471,7 +471,7 @@ if (n == 0) return n; - while (buf < endp) + while (buf < endp - 1) { if (*buf == 0x0d) { @@ -481,6 +481,8 @@ else *np++ = *buf++; } + if (buf < endp) + *np++ = *buf++; return np - startp; }