aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/crlcache.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-06-09 09:31:06 +0000
committerWerner Koch <[email protected]>2015-06-09 09:31:06 +0000
commit255dadd76d5a2101d2c5450741326b67253fa9ea (patch)
tree1b44d7d4c0e1afd36ff6541f605a52004ce2991d /dirmngr/crlcache.c
parentdoc: Change the manual source to be only for GnuPG 2.1 (diff)
downloadgnupg-255dadd76d5a2101d2c5450741326b67253fa9ea.tar.gz
gnupg-255dadd76d5a2101d2c5450741326b67253fa9ea.zip
dirmngr: Avoid crash due to an empty crls.d/DIR.txt.
* dirmngr/crlcache.c (check_dir_version): Avoid segv. -- GnuPG-bug-id: 1842 Debian-bug-id: 776611
Diffstat (limited to 'dirmngr/crlcache.c')
-rw-r--r--dirmngr/crlcache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dirmngr/crlcache.c b/dirmngr/crlcache.c
index d10e3ca78..d4c3dcb2a 100644
--- a/dirmngr/crlcache.c
+++ b/dirmngr/crlcache.c
@@ -479,7 +479,9 @@ check_dir_version (estream_t *fpadr, const char *fname,
if (lineerr)
return lineerr;
- if (strtol (line+2, NULL, 10) != DBDIRVERSION)
+ /* The !line catches the case of an empty DIR file. We handle this
+ the same as a non-matching version. */
+ if (!line || strtol (line+2, NULL, 10) != DBDIRVERSION)
{
if (!created && cleanup_on_mismatch)
{