Re: patch: avoid reading after end of string

2014-11-18 Thread Otto Moerbeek
On Tue, Nov 18, 2014 at 04:41:52PM +0100, Tobias Stoeckmann wrote: > On Tue, Nov 18, 2014 at 04:32:17PM +0100, Otto Moerbeek wrote: > > I seem to remember other code guarantees that lines are always > > termined by '\n'. Specifically plan_a(), plan_b() and ifetch(); > > Not in this case. We use

Re: patch: avoid reading after end of string

2014-11-18 Thread Todd C. Miller
On Tue, 18 Nov 2014 16:41:52 +0100, Tobias Stoeckmann wrote: > Not in this case. We use the output of fgets. Good catch, OK millert@ - todd

Re: patch: avoid reading after end of string

2014-11-18 Thread Tobias Stoeckmann
On Tue, Nov 18, 2014 at 04:32:17PM +0100, Otto Moerbeek wrote: > I seem to remember other code guarantees that lines are always > termined by '\n'. Specifically plan_a(), plan_b() and ifetch(); Not in this case. We use the output of fgets. This would be a valid contextual diff: $ echo a > a $ e

Re: patch: avoid reading after end of string

2014-11-18 Thread Otto Moerbeek
Hi, I seem to remember other code guarantees that lines are always termined by '\n'. Specifically plan_a(), plan_b() and ifetch(); -Otto On Tue, Nov 18, 2014 at 03:27:27PM +0100, Tobias Stoeckmann wrote: > Hi, > > on a diff with a missing new line, it is possible that patch will read

patch: avoid reading after end of string

2014-11-18 Thread Tobias Stoeckmann
Hi, on a diff with a missing new line, it is possible that patch will read past the terminating NUL character. Tobias Index: pch.c === RCS file: /cvs/src/usr.bin/patch/pch.c,v retrieving revision 1.42 diff -u -p -r1.42 pch.c --- pc