Fix use-after-free of hash_name

pull/1884/head
jsteube 5 years ago
parent de690abfa6
commit b2154b7ed9

@ -35,8 +35,8 @@ double status_get_guess_mod_percent (const hashcat_ctx_t *hash
char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx);
int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx);
char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx);
const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx);
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx);

@ -2056,8 +2056,8 @@ typedef struct device_info
typedef struct hashcat_status
{
const char *hash_target;
const char *hash_type;
char *hash_target;
char *hash_name;
int guess_mode;
char *guess_base;
int guess_base_offset;

@ -1396,7 +1396,7 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
hashcat_status->digests_done = status_get_digests_done (hashcat_ctx);
hashcat_status->digests_percent = status_get_digests_percent (hashcat_ctx);
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
hashcat_status->hash_type = status_get_hash_type (hashcat_ctx);
hashcat_status->hash_name = status_get_hash_name (hashcat_ctx);
hashcat_status->guess_base = status_get_guess_base (hashcat_ctx);
hashcat_status->guess_base_offset = status_get_guess_base_offset (hashcat_ctx);
hashcat_status->guess_base_count = status_get_guess_base_count (hashcat_ctx);

@ -289,14 +289,14 @@ int status_get_status_number (const hashcat_ctx_t *hashcat_ctx)
return status_ctx->devices_status;
}
const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx)
char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
return hashconfig->hash_name;
return hcstrdup (hashconfig->hash_name);
}
const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const hashes_t *hashes = hashcat_ctx->hashes;
@ -324,7 +324,7 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
{
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
{
return hashes->hashfile;
return hcstrdup (hashes->hashfile);
}
else
{
@ -346,7 +346,7 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
}
else
{
return hashes->hashfile;
return hcstrdup (hashes->hashfile);
}
}
@ -2159,6 +2159,8 @@ void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashca
if (status_ctx->accessible == false) return;
hcfree (hashcat_status->hash_target);
hcfree (hashcat_status->hash_name);
hcfree (hashcat_status->session);
hcfree (hashcat_status->time_estimated_absolute);
hcfree (hashcat_status->time_estimated_relative);
@ -2170,6 +2172,8 @@ void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashca
hcfree (hashcat_status->guess_charset);
hcfree (hashcat_status->cpt);
hashcat_status->hash_target = NULL;
hashcat_status->hash_name = NULL;
hashcat_status->session = NULL;
hashcat_status->time_estimated_absolute = NULL;
hashcat_status->time_estimated_relative = NULL;

@ -933,8 +933,8 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
hashcat_status->status_string);
event_log_info (hashcat_ctx,
"Hash.Type........: %s",
hashcat_status->hash_type);
"Hash.Name........: %s",
hashcat_status->hash_name);
event_log_info (hashcat_ctx,
"Hash.Target......: %s",

Loading…
Cancel
Save