From 9b1fc991e07698d637f3dacb608be7ceb9ca853d Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 1 Oct 2005 18:38:09 +1000 Subject: [INPUT] Fix NUL skipping in preadbuffer On Sun, Sep 25, 2005 at 07:50:54PM +0000, Gerrit Pape wrote: > On Sat, Sep 03, 2005 at 02:56:00PM +0200, Martin Dickopp wrote: > > When analysing the bug I came to the following conclusion: The loop > > beginning at input.c:302 overwrites a single input line with itself, > > skipping NUL characters. Therefore, after the loop the line buffer > > has less characters than originally read if and only if the input line > > contains NUL characters. > > yes. Thanks a lot for the details and patch. > > > The pointer that is used to read from the buffer, 'parsenextc' (cf. > > input.h:66), is also used as the beginning of the next line in > > input.c:296. This fails if the buffer contains less characters > > than originally read into it due to NUL characters. > > > > The proposed patch (attached) keeps track of the number of skipped > > characters and advances 'parsenextc' accordingly before processing > > the next input line. > > Hi Herbert, please see > http://bugs.debian.org/317516 Instead of moving the characters in the loop, we will do memmove every time we see a NUL character. This hurts if there are a lot of NUL characters, but should be a win in normal situations. --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index a01503a..e7253d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-01 Herbert Xu + + * Skip NUL characters properly in input.c + 2005-03-28 Herbert Xu * Removed some unnecessary inclusions of input.h. -- cgit 1.4.1