[PATCH] tofu: fix null pointer dereference.

Ben Kibbey bjk at luxsci.net
Tue Jul 19 00:51:30 CEST 2016


* g10/tofu.c (tofu_closedbs): test for NULL.

Signed-off-by: Ben Kibbey <bjk at luxsci.net>
---
 g10/tofu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/g10/tofu.c b/g10/tofu.c
index 471aec6..b0686e5 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -1107,7 +1107,8 @@ tofu_closedbs (ctrl_t ctrl)
           while (-- skip > 0)
             old_head = old_head->next;
 
-          *old_head->prevp = NULL;
+          if (old_head)
+            *old_head->prevp = NULL;
 
           while (old_head)
             {
-- 
2.8.1




More information about the Gnupg-devel mailing list