summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-03-16 09:01:24 +0100
committerWerner Koch <wk@gnupg.org>2015-03-16 09:31:03 +0100
commitfbb97dcf763e28e81e01092ad4c934b3eaf88cc8 (patch)
tree84d2235d6a1de2783157bf0ac66b622cdb308520
parent5e66a4f8d5a63f58caeee367433dd8dd32346083 (diff)
downloadlibgcrypt-fbb97dcf763e28e81e01092ad4c934b3eaf88cc8.tar.gz
cipher: Remove useless NULL check.
* cipher/hash-common.c (_gcry_md_block_write): Remove NUL check for hd->buf. -- HD->BUF is not allocated but part of the struct. HD has already be dereferenced twice thus the check does not make sense. Detected by Stack 0.3: bug: anti-simplify model: | %cmp4 = icmp eq i8* %arraydecay, null, !dbg !29 --> false stack: - /home/wk/s/libgcrypt/cipher/hash-common.c:114:0 ncore: 1 core: - /home/wk/s/libgcrypt/cipher/hash-common.c:108:0 - null pointer dereference Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--cipher/hash-common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cipher/hash-common.c b/cipher/hash-common.c
index 9a007e12..6743f09b 100644
--- a/cipher/hash-common.c
+++ b/cipher/hash-common.c
@@ -111,7 +111,7 @@ _gcry_md_block_write (void *context, const void *inbuf_arg, size_t inlen)
if (sizeof(hd->buf) < blocksize)
BUG();
- if (hd->buf == NULL || hd->bwrite == NULL)
+ if (!hd->bwrite)
return;
if (hd->count == blocksize) /* Flush the buffer. */