File Reads: Fixed memory leak in case outfile or hashfile was not accessible

pull/1074/head
jsteube 7 years ago
parent cb58c84754
commit c859cff25c

@ -77,6 +77,7 @@
- OpenCL Kernel: Renumbered hash-mode 7600 to 4521
- OpenCL Device: Do a check on available constant memory size and abort if it's less than 64kB
- File Reads: Improved error detection on file reads, especially when getting the file stats
- File Reads: Fixed memory leak in case outfile or hashfile was not accessible
- File Locking: Improved error detection on file locks
- Hash Parsing: Added additional bound checks for the SIP digest authentication (MD5) parser (-m 11400)
- Sessions: Move out handling of multiple instance from restore file into separate pidfile

@ -1568,25 +1568,41 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
hc_stat_t tmpstat_outfile = { 0 };
hc_stat_t tmpstat_hashfile = { 0 };
int do_check = 0;
FILE *tmp_outfile_fp = fopen (outfile, "r");
if (tmp_outfile_fp)
{
if (hc_fstat (fileno (tmp_outfile_fp), &tmpstat_outfile)) return -1;
if (hc_fstat (fileno (tmp_outfile_fp), &tmpstat_outfile))
{
fclose (tmp_outfile_fp);
return -1;
}
fclose (tmp_outfile_fp);
do_check++;
}
FILE *tmp_hashfile_fp = fopen (hashfile, "r");
if (tmp_hashfile_fp)
{
if (hc_fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile)) return -1;
if (hc_fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile))
{
fclose (tmp_hashfile_fp);
return -1;
}
fclose (tmp_hashfile_fp);
do_check++;
}
if (tmp_outfile_fp)
if (do_check == 2)
{
tmpstat_outfile.st_mode = 0;
tmpstat_outfile.st_nlink = 0;

Loading…
Cancel
Save