summaryrefslogtreecommitdiff
path: root/cipher/md.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-08-21 11:47:16 +0200
committerWerner Koch <wk@gnupg.org>2014-08-21 12:22:37 +0200
commitf850add813d783f31ca6a60459dea25ef71bce7e (patch)
tree4ba983267897306c947efe70d56e0ac4a2bdeee6 /cipher/md.c
parent18056ace7f466cb8c1eaf08e5dc0400516d83b4c (diff)
downloadlibgcrypt-f850add813d783f31ca6a60459dea25ef71bce7e.tar.gz
cipher: Fix a segv in case of calling with wrong parameters.
* cipher/md.c (_gcry_md_info): Fix arg testing. -- GnuPG-bug-id: 1697
Diffstat (limited to 'cipher/md.c')
-rw-r--r--cipher/md.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cipher/md.c b/cipher/md.c
index a1e5859c..df8b027e 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -1181,7 +1181,7 @@ _gcry_md_info (gcry_md_hd_t h, int cmd, void *buffer, size_t *nbytes)
GcryDigestEntry *r;
int algo;
- if ( !buffer || (nbytes && (*nbytes != sizeof (int))))
+ if ( !buffer || !nbytes || *nbytes != sizeof (int))
rc = GPG_ERR_INV_ARG;
else
{