Fix potential array overrun in act_to_str
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Dec 2011 19:06:31 +0000 (13:06 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 1 Feb 2012 12:14:26 +0000 (13:14 +0100)
The acts[] array is only N_ACTS elements, so we should not
ever set acts[N_ACTS]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
blkrawverify.c

index b6ceb9d08e7acac4377f292ecf88ccb930ea0b7e..4638eb7330f3320eebcb0180bada70db9dc3f795 100644 (file)
@@ -87,7 +87,7 @@ static char *act_to_str(__u32 action)
        unsigned int act = action & 0xffff;
        unsigned int trace = (action >> BLK_TC_SHIFT) & 0xffff;
 
-       if (act <= N_ACTS) {
+       if (act < N_ACTS) {
                sprintf(buf, "%s ", acts[act].string);
                for (i = 0; i < N_TRACES; i++)
                        if (trace & (1 << i)) {