Fixes #23930 - fix ssdeep formatting ##print

This commit is contained in:
Matt Brooks 2025-02-02 09:51:06 -06:00 committed by pancake
parent 3a17978312
commit aa0ae185e2

View File

@ -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;