corrupt: fix end==0 bug
This commit is contained in:
parent
cc06aaad96
commit
2083670ace
|
@ -43,13 +43,15 @@ match_rule(config_t *conf, dosfile_t *file)
|
||||||
int
|
int
|
||||||
corrupt_file(dosfs_t *fsd, dosfile_t *file, config_t *conf, uint32_t *state)
|
corrupt_file(dosfs_t *fsd, dosfile_t *file, config_t *conf, uint32_t *state)
|
||||||
{
|
{
|
||||||
uint32_t off;
|
uint32_t off, end;
|
||||||
int real_off;
|
int real_off;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
struct conf_opts_t opts;
|
struct conf_opts_t opts;
|
||||||
|
|
||||||
|
end = (conf->end) ? conf->end : file->ent.size;
|
||||||
|
|
||||||
opts = conf->opts;
|
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)) {
|
off += xs_randb(state, conf->skip_a, conf->skip_b)) {
|
||||||
real_off = get_byte_offset(fsd, file, off);
|
real_off = get_byte_offset(fsd, file, off);
|
||||||
if (real_off < 0) {
|
if (real_off < 0) {
|
||||||
|
|
Loading…
Reference in a new issue