From 2083670aceff0e6712241bf955ce6427edf8bd96 Mon Sep 17 00:00:00 2001 From: snow flurry Date: Tue, 17 Nov 2020 22:19:00 -0800 Subject: [PATCH] corrupt: fix end==0 bug --- src/corrupt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corrupt.c b/src/corrupt.c index 2be7b33..d90eafd 100644 --- a/src/corrupt.c +++ b/src/corrupt.c @@ -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) {