Anyone into reviewing? Or suggestions?
In short, this diff verifies that we don't try to write lines into
the file buffer which are longer than the longest one allowed.
Tobias
> Index: inp.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/patch/inp.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 inp.c
> --- inp.c 8 Oct 2014 04:06:23 -0000 1.38
> +++ inp.c 9 Nov 2014 16:45:33 -0000
> @@ -381,6 +381,8 @@ plan_b(const char *filename)
> revision);
> }
> fseek(ifp, 0L, SEEK_SET); /* rewind file */
> + if (maxlen > BUFFERSIZE)
> + fatal("lines too long\n");
> lines_per_buf = BUFFERSIZE / maxlen;
> tireclen = maxlen;
> tibuf[0] = malloc(BUFFERSIZE + 1);