mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib: fix NULL checks for filenames iterators
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>
This commit is contained in:
parent
7cd3cd3003
commit
8dd4e9770e
1 changed files with 2 additions and 2 deletions
|
@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)
|
||||||
const char *
|
const char *
|
||||||
notmuch_filenames_get (notmuch_filenames_t *filenames)
|
notmuch_filenames_get (notmuch_filenames_t *filenames)
|
||||||
{
|
{
|
||||||
if (filenames->iterator == NULL)
|
if ((filenames == NULL) || (filenames->iterator == NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return filenames->iterator->string;
|
return filenames->iterator->string;
|
||||||
|
@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
|
||||||
void
|
void
|
||||||
notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
|
notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
|
||||||
{
|
{
|
||||||
if (filenames->iterator == NULL)
|
if ((filenames == NULL) || (filenames->iterator == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
filenames->iterator = filenames->iterator->next;
|
filenames->iterator = filenames->iterator->next;
|
||||||
|
|
Loading…
Reference in a new issue