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 the output of fgets.
> 
> This would be a valid contextual diff:
> 
> $ echo a > a
> $ echo b > b
> $ diff -c a b > a.diff
> $ cat a.diff
> *** a   Tue Nov 18 16:36:31 2014
> --- b   Tue Nov 18 16:36:34 2014
> ***************
> *** 1 ****
> ! a
> --- 1 ----
> ! b
> 
> If we remove the last 3 lines and also remove the newline of
> "*** 1 ****", then fgets will return it without a \n.  I've inserted
> a printf into the loop to verify that we get past the \0.
> 
> In general, nothing much will happen, because we won't get out of buf[]
> due to the previous lines.  But it's still a bug.
> 
> 
> Tobias

OK, 

        -Otto

Reply via email to