Alan DeKok wrote:
>
> "Vic Abell" <[EMAIL PROTECTED]> wrote:
> > When processing a $INCLUDE directive, the following code in
> > pairlist_read() of main/files.c may cause any accumulated
> > pair information to be lost when the recursion of the function
> > returns a NULL to its PAIR_LIST **list argument.  This can
> > happen, for example, when the users file has a $INCLUDE that
> > names an empty file and other pairs or $INCLUDE directives
> > follow.
> 
>   OK.
> 
> >     last = t;
> >     while (last && last->next)
> >             last = last->next;
> > 
> > If t == NULL, then last will become NULL.  If any pairs or any
> > $INCLUDE follow the $INCLUDE that caused pairlist_read() to set
> > t == NULL, all pairs recorded prior to the $INCLUDE of the empty
> > file will be lost.
> 
>   You're right.
> 
> > A fix that appears to work that has been tested under 0.8.1 is:
> 
>   The solution is simpler.  Make 'last' a pointer to a pointer,
> instead of a pointer.  That gets rid of lots of "if" statements, and
> we can do:
> 
>   PAIR_LIST *pl = NULL;
>   PAIR_LIST **last = &pl;
> 
>   ...
> 
>   *last = t;
>   last = &t->next

If t == NULL, won't &t->next attempt to de-reference a
NULL pointer?

Isn't pl supposed to point to the first pair gleaned
from the recursion on users?  Always setting it to t
won't preserve that condition.

Isn't last (currently) supposed to point to the end
of the chain whose head is contained in pl?  I thought
last was used to help extend pl's chain.  I don't see how
the chain whose pointer is returned in t is linked to the
end of pl's chain via last->next.

Perhaps I'm not seeing the full context of your change.
 
>   ...
> 
>   I've commited a fix, thanks.

Vic Abell

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to