diff options
author | Robert Buchholz <rbu@goodpoint.de> | 2012-07-19 17:14:47 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-09-10 09:23:59 +0200 |
commit | b67e45b858466acac1f410747893d6d717426287 (patch) | |
tree | 013524adbc67f917a9a21f25574a2cabf29e8758 /raid6check.c | |
parent | Move xmalloc et al into their own file (diff) | |
download | mdadm-b67e45b858466acac1f410747893d6d717426287.tar.xz mdadm-b67e45b858466acac1f410747893d6d717426287.zip |
raid6check: Fix off-by-one in argument check
In repair mode, specifying a failed slot that is equal to the number of
devices in the raid could cause a segfault.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'raid6check.c')
-rw-r--r-- | raid6check.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/raid6check.c b/raid6check.c index aba8160f..dffadbe3 100644 --- a/raid6check.c +++ b/raid6check.c @@ -416,12 +416,12 @@ int main(int argc, char *argv[]) failed_disk1 = getnum(argv[4], &err); failed_disk2 = getnum(argv[5], &err); - if(failed_disk1 > info->array.raid_disks) { + if(failed_disk1 >= info->array.raid_disks) { fprintf(stderr, "%s: failed_slot_1 index is higher than number of devices in raid\n", prg); exit_err = 4; goto exitHere; } - if(failed_disk2 > info->array.raid_disks) { + if(failed_disk2 >= info->array.raid_disks) { fprintf(stderr, "%s: failed_slot_2 index is higher than number of devices in raid\n", prg); exit_err = 4; goto exitHere; |