The API documentation (notmuch.h) states that the parameter may be NULL,
but the implementation only checked the current element, potentially
dereferencing a NULL pointer in the process.
Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
const char *
notmuch_filenames_get (notmuch_filenames_t *filenames)
{
- if (filenames->iterator == NULL)
+ if ((filenames == NULL) || (filenames->iterator == NULL))
return NULL;
return filenames->iterator->string;
void
notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
{
- if (filenames->iterator == NULL)
+ if ((filenames == NULL) || (filenames->iterator == NULL))
return;
filenames->iterator = filenames->iterator->next;