From df46e00bbc2eda3d6a888b254f1d7822ea88c460 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Sun, 2 Feb 2025 09:51:06 -0600 Subject: [PATCH 1/2] Fixes #23930 - fix ssdeep formatting ##print --- libr/crypto/hash/hash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libr/crypto/hash/hash.c b/libr/crypto/hash/hash.c index 162bb163c4386..1c45c5d0ac2ec 100644 --- a/libr/crypto/hash/hash.c +++ b/libr/crypto/hash/hash.c @@ -395,7 +395,10 @@ R_API R_MUSTUSE char *r_hash_tostring(R_NULLABLE RHash *ctx, const char *name, c digest_hex = calloc (digest_hex_size, 1); snprintf (digest_hex, digest_hex_size, "%02.8f", ctx->entropy); } else if (digest_size > 0) { - if (digest_size * 2 < digest_size) { + if (algo & R_HASH_SSDEEP) { + digest_hex = malloc (digest_size + 1); + snprintf (digest_hex, digest_size + 1, "%s", ctx->digest); + } else if (digest_size * 2 < digest_size) { digest_hex = NULL; } else { digest_hex_size = (digest_size * 2) + 1; From cd340f0a4364324ad239ea839ef9c86304c5b9e2 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Sun, 2 Feb 2025 10:06:25 -0600 Subject: [PATCH 2/2] Add iS ssdeep regression test ##test --- test/db/cmd/cmd_i | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/db/cmd/cmd_i b/test/db/cmd/cmd_i index 6cf75f9cda32d..8bdf0721acc03 100644 --- a/test/db/cmd/cmd_i +++ b/test/db/cmd/cmd_i @@ -3721,6 +3721,29 @@ nth paddr vaddr bind type size lib name demangled EOF RUN +NAME=iS ssdeep +FILE=bins/mach0/ls-m1 +ARGS=-a arm -b64 +CMDS=<