diff --git a/src/output-json-email-common.c b/src/output-json-email-common.c index 4fd79859d4..93e54119fa 100644 --- a/src/output-json-email-common.c +++ b/src/output-json-email-common.c @@ -131,15 +131,10 @@ static void EveEmailLogJSONMd5(OutputJsonEmailCtx *email_ctx, JsonBuilder *js, S } field = MimeDecFindField(entity, "subject"); if (field != NULL) { - unsigned char md5[SC_MD5_LEN]; - char smd5[256]; + char smd5[SC_MD5_HEX_LEN + 1]; char *value = BytesToString((uint8_t *)field->value , field->value_len); if (value) { - size_t i,x; - SCMd5HashBuffer((uint8_t *)value, strlen(value), md5, sizeof(md5)); - for (i = 0, x = 0; x < sizeof(md5); x++) { - i += snprintf(smd5 + i, 255 - i, "%02x", md5[x]); - } + SCMd5HashBufferToHex((uint8_t *)value, strlen(value), smd5, sizeof(smd5)); jb_set_string(js, "subject_md5", smd5); SCFree(value); }