From de4a2ff7adde8462e59ce30054e71bc569b86eef Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 23 Dec 2012 22:15:30 -0500 Subject: [PATCH] Fix valid_agent_grip () returning a false-positive. --- src/cache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cache.c b/src/cache.c index f4ea6104..f1b5e972 100644 --- a/src/cache.c +++ b/src/cache.c @@ -154,7 +154,7 @@ static int valid_agent_grip (file_cache_t *e) for (c = 0; c < sizeof (e->grip); c++) { - if (e->grip[c]) + if (e->grip[c] && e->grip[c] != '0') return 1; } @@ -271,6 +271,8 @@ setgrip (file_cache_t * p, const unsigned char *grip) memcpy (p->grip, tmp, sizeof (p->grip)); xfree (tmp); } + else + memset (p->grip, 0, sizeof(p->grip)); } static gpg_error_t @@ -560,7 +562,7 @@ cache_deinit (int atfork) #ifdef WITH_AGENT if (atfork && valid_agent_grip (p)) - continue; + continue; #endif free_entry (p); -- 2.11.4.GIT