From df46e00bbc2eda3d6a888b254f1d7822ea88c460 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Sun, 2 Feb 2025 09:51:06 -0600 Subject: [PATCH] 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;