Re: [PATCH 2/3] vcs-svn: Start working on the dumpfile producer
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jan 15, 2011, 08:11 UTC
- Message-ID
- <20110115081128.GB9277@kytes>
- In-Reply-To
- <20110115073925.GA21744@m62s10.vlinux.de>
Hi Peter,
Peter Baumann writes:
Show 14 quoted lines
> > + while ((t = buffer_read_line(&input))) {
> > + val = strchr(t, ' ');
> > + if (!val) {
> > + if (!memcmp(t, "blob", 4))
> > + active_ctx = BLOB_CTX;
> > + else if (!memcmp(t, "deleteall", 9))
> > + ;
> > + continue;
>
> Having actually no idea what the input you are reading from might look like, but
> seeing those two memcmp compares above makes me wonder if 't' might ever be smaller
> than 4 (or 9 for the else part). Which obviously would lead to a SEGFAULT.
> In the code below there are also memcmp class which might step out of the
> buffer.Right. Silly mistake on my part. Thanks for pointing it out.
There are probably many more trivial mistakes- I was in a hurry to get /something/ working, and didn't have a chance to clean up the code.
-- Ram