corrupt: fix end==0 bug

This commit is contained in:
snow flurry 2020-11-17 22:19:00 -08:00
parent cc06aaad96
commit 2083670ace

View file

@ -43,13 +43,15 @@ match_rule(config_t *conf, dosfile_t *file)
int
corrupt_file(dosfs_t *fsd, dosfile_t *file, config_t *conf, uint32_t *state)
{
uint32_t off;
uint32_t off, end;
int real_off;
unsigned char c;
struct conf_opts_t opts;
end = (conf->end) ? conf->end : file->ent.size;
opts = conf->opts;
for (off = conf->start; (off < conf->end) && (off < file->ent.size);
for (off = conf->start; (off < end) && (off < file->ent.size);
off += xs_randb(state, conf->skip_a, conf->skip_b)) {
real_off = get_byte_offset(fsd, file, off);
if (real_off < 0) {