diff options
author | Matt Caswell <matt@openssl.org> | 2019-11-26 17:15:20 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-11-29 14:21:55 +0000 |
commit | 17197a2f61d04314b465b71a4ce164b5e219f15c (patch) | |
tree | c29704c6ca5c958adb250a42581da3feabd9d3fb /crypto/mem_dbg.c | |
parent | c1ff5994407bc093eca78eb2fd4f813b7ee581a2 (diff) |
Check the return from OPENSSL_buf2hexstr()
The function OPENSSL_buf2hexstr() can return NULL if it fails to allocate
memory so the callers should check its return value.
Fixes #10525
Reported-by: Ziyang Li (@Liby99)
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10526)
Diffstat (limited to 'crypto/mem_dbg.c')
-rw-r--r-- | crypto/mem_dbg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 779ad3cec9..561dd80437 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -374,8 +374,8 @@ static void print_leak(const MEM *m, MEM_LEAK *l) hex = OPENSSL_buf2hexstr((const unsigned char *)&m->threadid, sizeof(m->threadid)); - n = BIO_snprintf(bufp, len, "thread=%s, number=%d, address=%p\n", hex, - m->num, m->addr); + n = BIO_snprintf(bufp, len, "thread=%s, number=%d, address=%p\n", + hex == NULL ? "<null>" : hex, m->num, m->addr); OPENSSL_free(hex); if (n <= 0) return; |