1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 11:28:15 +00:00

Fixed a bug in line counter: Conditional jump or move depends on uninitialised value

This commit is contained in:
Jens Steube 2016-02-10 16:56:51 +01:00
parent e80541d6dd
commit 8d85b7539d
2 changed files with 12 additions and 27 deletions

View File

@ -111,15 +111,19 @@ Trac.: 684
Type.: Bug
File.: Kernel
Desc.: Fix a bug in the implementation of GOST R 34.11-94, zero length passwords were not cracked
Desc.: Fixed a bug in the implementation of GOST R 34.11-94: Zero length passwords were not cracked
Type.: Bug
File.: Kernel
Desc.: Fix a bug in rule-engine for NVidia devices, the code for left- and right-shift were switched
Desc.: Fixed a bug in rule-engine for NVidia devices: Code for left- and right-shift were switched
Type.: Bug
File.: Host
Desc.: Forced default iteration count for -m 2100 = DCC2 hashes to 10240
Desc.: Fixed a bug in -m 2100 = DCC2: Forced default iteration count for hashes to 10240
Type.: Bug
File.: Host
Desc.: Fixed a bug in line counter: Conditional jump or move depends on uninitialised value
* changes v2.00 -> v2.01:

View File

@ -1843,40 +1843,21 @@ static uint count_lines (FILE *fd)
char *buf = (char *) mymalloc (BUFSIZ + 1);
size_t nread_tmp = 0;
char *ptr = buf;
char prev = '\n';
while (!feof (fd))
{
size_t nread = fread (buf, sizeof (char), BUFSIZ, fd);
nread_tmp = nread;
if (nread < 1) continue;
ptr = buf;
size_t i;
do
for (i = 0; i < nread; i++)
{
if (*ptr++ == '\n') cnt++;
if (prev == '\n') cnt++;
} while (nread--);
}
// special case (if last line did not contain a newline char ... at the very end of the file)
if (nread_tmp > 3)
{
ptr -= 2;
if (*ptr != '\n')
{
ptr--;
if (*ptr != '\n') // needed ? different on windows systems?
{
cnt++;
}
prev = buf[i];
}
}