summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2021-01-24 22:25:13 +0000
committerSimon Kelley <simon@thekelleys.org.uk>2021-01-24 22:25:13 +0000
commit20295012b8815d0989332516c6ac51018746e92e (patch)
tree0f240e29970019ad556d356f12ce3c3ec9c423f7
parent807e82343a62ef7dd1dd052441bcfa58347201b0 (diff)
downloaddnsmasq-20295012b8815d0989332516c6ac51018746e92e.tar.gz
Fix possible free-memory ref in e75069f79aa6b8a61034a9a4db9b6265b8be8ae4v2.84rc2v2.84
-rw-r--r--src/hash_questions.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/hash_questions.c b/src/hash_questions.c
index 8b96505..8e1559f 100644
--- a/src/hash_questions.c
+++ b/src/hash_questions.c
@@ -36,8 +36,11 @@ static unsigned char *digest;
void hash_questions_init(void)
{
- if (!(hash = hash_find("sha256")) || !hash_init(hash, &ctx, &digest))
+ if (!(hash = hash_find("sha256")))
die(_("Failed to create SHA-256 hash object"), NULL, EC_MISC);
+
+ ctx = safe_malloc(hash->context_size);
+ digest = safe_malloc(hash->digest_size);
}
unsigned char *hash_questions(struct dns_header *header, size_t plen, char *name)