From ee5c45399e86e4639b8b1426131aa7e9bfe87163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=D0=B5x=D0=B0nder=20Lysik=D0=BEv?= <alexander.lysikov@demlabs.net> Date: Wed, 10 Jul 2019 22:14:31 +0500 Subject: [PATCH] fix a few potential bugs --- dap_hash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dap_hash.c b/dap_hash.c index 72dc340..50f23f2 100755 --- a/dap_hash.c +++ b/dap_hash.c @@ -38,6 +38,8 @@ int dap_hash_fast(const void *a_data_in, size_t a_data_in_size, dap_chain_hash_f bool dap_hash_fast_is_blank(dap_chain_hash_fast_t *a_hash) { + if(!a_hash) + return true; uint8_t *l_hast_bytes = (uint8_t*) a_hash; for(size_t i = 0; i < sizeof(dap_chain_hash_fast_t); i++) { if(l_hast_bytes[i]) @@ -48,6 +50,8 @@ bool dap_hash_fast_is_blank(dap_chain_hash_fast_t *a_hash) bool dap_hash_fast_compare(dap_chain_hash_fast_t *a_hash1, dap_chain_hash_fast_t *a_hash2) { + if(!a_hash1 || !a_hash2) + return false; if(!memcmp(a_hash1, a_hash2, sizeof(dap_chain_hash_fast_t))) return true; return false; -- GitLab