From 123a9f96fde3fe08a20256812f5baaca3958d536 Mon Sep 17 00:00:00 2001
From: "roman.khlopkov" <roman.khlopkov@demlabs.net>
Date: Sat, 30 Mar 2024 20:49:57 +0300
Subject: [PATCH] [*] Mempool commands bad hash conversion segfault fix

---
 modules/net/dap_chain_node_cli_cmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index d25d1a8464..f95bd2aaa3 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -3777,6 +3777,10 @@ int com_mempool(int a_argc, char **a_argv, void **a_str_reply)
             l_datum_hash = dap_enc_base58_to_hex_str_from_str(l_datum_hash_in);
         } else
             l_datum_hash = dap_strdup(l_datum_hash_in);
+        if (!l_datum_hash) {
+            dap_json_rpc_error_add(-4, "Can't convert hash string %s to hex string", l_datum_hash_in);
+            return -4;
+        }
     }
     int ret = -100;
     switch (l_cmd) {
-- 
GitLab