Re: Buffer overflow in /usr/bin/deroff

2023-09-28 Thread Ingo Schwarze
Hi, up front, thanks for finding and fixing this and sorry for not coming round to testing the patch before commit. Crystal Kolipe wrote on Wed, Sep 27, 2023 at 06:04:01PM -0300: > On Wed, Sep 27, 2023 at 02:05:14PM -0600, Todd C. Miller wrote: >> As written, deroff will not emit a line that

Re: Buffer overflow in /usr/bin/deroff

2023-09-27 Thread Crystal Kolipe
On Wed, Sep 27, 2023 at 02:05:14PM -0600, Todd C. Miller wrote: > On Wed, 27 Sep 2023 10:59:26 -0600, "Todd C. Miller" wrote: > > > I think we want support for arbitrary line lengths. There is only > > one place where we need to reallocate the line buffer. > > The correct check is for "lp -

Re: Buffer overflow in /usr/bin/deroff

2023-09-27 Thread Todd C . Miller
On Wed, 27 Sep 2023 10:59:26 -0600, "Todd C. Miller" wrote: > I think we want support for arbitrary line lengths. There is only > one place where we need to reallocate the line buffer. The correct check is for "lp - line == linesz - 1". The code will overwrite the newline with a NUL so we

Re: Buffer overflow in /usr/bin/deroff

2023-09-27 Thread Todd C . Miller
On Wed, 27 Sep 2023 08:37:49 -0300, Crystal Kolipe wrote: > So what do we want? > > 1. Traditional OpenBSD behaviour of breaking input lines at 2047, >(which never actually worked correctly up to now). > 2. Breaking input at 2048. > 3. Support for arbitrary line length with no breaking. > >

Re: Buffer overflow in /usr/bin/deroff

2023-09-27 Thread Crystal Kolipe
Hi Marc, On Tue, Sep 19, 2023 at 03:24:41PM +0200, Marc Espie wrote: > On Tue, Sep 19, 2023 at 09:48:25AM -0300, Crystal Kolipe wrote: > > deroff chokes when given lines > 2048 bytes, and produces non-deterministic > > output on little endian archs. > > Since you went to the trouble of

Re: Buffer overflow in /usr/bin/deroff

2023-09-19 Thread Marc Espie
On Tue, Sep 19, 2023 at 09:48:25AM -0300, Crystal Kolipe wrote: > deroff chokes when given lines > 2048 bytes, and produces non-deterministic > output on little endian archs. > > Reproducer: > > $ jot -s '' -b blah 513 > /tmp/blah > $ for i in 1 2 3 4 ; do deroff /tmp/blah | md5 ; done >