diff options
author | Karel Zak <kzak@redhat.com> | 2009-04-03 11:02:17 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2009-04-03 11:02:17 +0200 |
commit | 87aab0e19af5964d88ed5945e6489ce90cc4ce60 (patch) | |
tree | 6add469f7b412296463bbd34058d5f2e5f07b7ed | |
parent | ed64b8d0fc945ce49041f313c453b6b21d68b832 (diff) | |
download | util-linux-old-87aab0e19af5964d88ed5945e6489ce90cc4ce60.tar.gz |
blkid: check idinfo[] index
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libs/blkid/src/probe.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index 0fd3c101..604c7eba 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -258,6 +258,7 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->fd = fd; pr->off = off; pr->size = 0; + pr->idx = 0; if (size) pr->size = size; @@ -284,7 +285,6 @@ int blkid_probe_set_device(blkid_probe pr, int fd, DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%zd, size=%zd\n", pr->off, pr->size)); - pr->idx = 0; return 0; } @@ -453,6 +453,9 @@ int blkid_do_probe(blkid_probe pr) if (pr->idx) i = pr->idx + 1; + if (i < 0 && i >= ARRAY_SIZE(idinfos)) + return -1; + DBG(DEBUG_LOWPROBE, printf("--> starting probing loop\n")); for ( ; i < ARRAY_SIZE(idinfos); i++) { |