[pacman-dev] [BUG] alpm_list_remove need an initalized pointer for void **data

Xavier shiningxc at gmail.com
Thu Aug 7 11:49:50 EDT 2008


On Thu, Aug 7, 2008 at 5:36 PM, Dan McGee <dpmcgee at gmail.com> wrote:
>
> OK, you've found a much better test case here, thanks. This points us
> to line 302, the NULL set below:
>
>  if(data) {
>    *data = NULL;
>  }
>
> This check doesn't seem quite right- shouldn't we be checking *data
> for existance before we go setting things? Something like:
>
> if(data && *data) {
>  *data = NULL;
> }
>
> Or what do we do here? Double pointers start confusing me. :)
>

We already have this kind of code everywhere in libalpm. It does not
cause any problems when it is used correctly.
And I don't know how to make it safer either.
How can we know if data is actually a valid address, and so if we can
access *data or not.



More information about the pacman-dev mailing list