[PATCH 1/3] lib: fix NULL checks for filenames iterators

2012-09-01 Thread David Bremner
Sascha Silbe  writes:

> 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.
>

Pushed this one patch.

d


Re: [PATCH 1/3] lib: fix NULL checks for filenames iterators

2012-09-01 Thread David Bremner
Sascha Silbe  writes:

> 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.
>

Pushed this one patch.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] lib: fix NULL checks for filenames iterators

2012-06-24 Thread Sascha Silbe
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 
---
 lib/filenames.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/filenames.c b/lib/filenames.c
index f1ea243..4f7c0d8 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)
 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;
@@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
 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;
-- 
1.7.10



[PATCH 1/3] lib: fix NULL checks for filenames iterators

2012-06-24 Thread Sascha Silbe
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 
---
 lib/filenames.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/filenames.c b/lib/filenames.c
index f1ea243..4f7c0d8 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)
 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;
@@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
 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;
-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch