This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: xconq/8: Rule called "replace".
Thursday 07 August 2003 01.47 skrev Eric McDonald:
> On Wed, 6 Aug 2003, Erik Sigra wrote:
> > * Make sure that the name is not too long for the buffer. (But does the
> > rest of xconq always check such things?)
>
> No. But, my personal opinion is that these things should be checked for,
> even if it means either truncating strings or dynamically allocating
> memory to accomodate them. Xconq is quite admirable in that it tries to do
> a lot with pre-allocated buffers, but my admiration ends where segfaults
> begin.
Yes, truncating is needed. I will try to add it to the patch. A Large Enough®
buffer is not useful, because someone could have a replace rule like this:
(replace subrule (GNU "GNU's Not Unix") (<other replace rules>) ...)
The patch I sent stops circular substitutions of depth 1:
(replace subrule (rr rr) (<other replace rules>) ... )
But I have to make it stop circular substitutions of depth n by storing all
results before substitution and check each result after substitution against
the list. Here is an example of depth 3:
(replace subrule (ål mora) (ora orsa) (morsa ål))
> I added a patch about a month ago that did address some of these buffer
> overflows (by using dynamic allocation), and I didn't get any negative
> feedback about it, __FWIW.
Sounds good!