diff options
author | Matt Caswell <matt@openssl.org> | 2019-11-26 18:15:20 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-11-29 15:21:55 +0100 |
commit | 17197a2f61d04314b465b71a4ce164b5e219f15c (patch) | |
tree | c29704c6ca5c958adb250a42581da3feabd9d3fb /apps/openssl.c | |
parent | Check that OPENSSL_zalloc was successful when creating EVP types (diff) | |
download | openssl-17197a2f61d04314b465b71a4ce164b5e219f15c.tar.xz openssl-17197a2f61d04314b465b71a4ce164b5e219f15c.zip |
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 'apps/openssl.c')
-rw-r--r-- | apps/openssl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/openssl.c b/apps/openssl.c index 31f598815a..769555e5e1 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -113,7 +113,8 @@ static size_t internal_trace_cb(const char *buf, size_t cnt, tid = CRYPTO_THREAD_get_current_id(); hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid)); BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ", - hex, OSSL_trace_get_category_name(category)); + hex == NULL ? "<null>" : hex, + OSSL_trace_get_category_name(category)); OPENSSL_free(hex); BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX, strlen(buffer), buffer); |