mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-03 19:31:15 +00:00
Fixed string not null terminated when reading maskfiles
This commit is contained in:
parent
8ebd5188eb
commit
dc4f96f42e
@ -48,6 +48,7 @@
|
|||||||
- Fixed nvapi datatype definition for NvS32 and NvU32
|
- Fixed nvapi datatype definition for NvS32 and NvU32
|
||||||
- Fixed WPA/WPA2 cracking in case eapol frame is >= 248 byte
|
- Fixed WPA/WPA2 cracking in case eapol frame is >= 248 byte
|
||||||
- Fixed string not null terminated inside workaround for checking drm driver path
|
- Fixed string not null terminated inside workaround for checking drm driver path
|
||||||
|
- Fixed string not null terminated when reading maskfiles
|
||||||
|
|
||||||
##
|
##
|
||||||
## Technical
|
## Technical
|
||||||
|
@ -14,6 +14,8 @@ u64 count_lines (FILE *fd);
|
|||||||
|
|
||||||
int fgetl (FILE *fp, char *line_buf);
|
int fgetl (FILE *fp, char *line_buf);
|
||||||
|
|
||||||
|
size_t superchop_with_length (char *buf, const size_t len);
|
||||||
|
|
||||||
int in_superchop (char *buf);
|
int in_superchop (char *buf);
|
||||||
|
|
||||||
#endif // _FILEHANDLING_H
|
#endif // _FILEHANDLING_H
|
||||||
|
@ -82,6 +82,37 @@ int fgetl (FILE *fp, char *line_buf)
|
|||||||
return (line_len);
|
return (line_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t superchop_with_length (char *buf, const size_t len)
|
||||||
|
{
|
||||||
|
size_t new_len = len;
|
||||||
|
|
||||||
|
while (new_len)
|
||||||
|
{
|
||||||
|
if (buf[new_len - 1] == '\n')
|
||||||
|
{
|
||||||
|
new_len--;
|
||||||
|
|
||||||
|
buf[new_len] = 0;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf[new_len - 1] == '\r')
|
||||||
|
{
|
||||||
|
new_len--;
|
||||||
|
|
||||||
|
buf[new_len] = 0;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_len;
|
||||||
|
}
|
||||||
|
|
||||||
int in_superchop (char *buf)
|
int in_superchop (char *buf)
|
||||||
{
|
{
|
||||||
size_t len = strlen (buf);
|
size_t len = strlen (buf);
|
||||||
@ -92,6 +123,8 @@ int in_superchop (char *buf)
|
|||||||
{
|
{
|
||||||
len--;
|
len--;
|
||||||
|
|
||||||
|
buf[len] = 0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,13 +132,13 @@ int in_superchop (char *buf)
|
|||||||
{
|
{
|
||||||
len--;
|
len--;
|
||||||
|
|
||||||
|
buf[len] = 0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[len] = 0;
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,9 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t len = in_superchop (mp_file);
|
mp_file[nread] = 0;
|
||||||
|
|
||||||
|
const size_t len = superchop_with_length (mp_file, nread);
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user