diff options
author | Dong Jinguang <dongjinguang@huawei.com> | 2017-12-29 17:00:37 +0800 |
---|---|---|
committer | Dong Jinguang <dongjinguang@huawei.com> | 2017-12-29 17:06:19 +0800 |
commit | 38324e758b803e99419d24e16a00b32f8ebbf473 (patch) | |
tree | 9c87c5344f3f145ab119d4279204af8bcd97589b | |
parent | c010544766c02529438565ebac8fb931d632a5d8 (diff) | |
download | android_external_e2fsprogs-38324e758b803e99419d24e16a00b32f8ebbf473.tar.gz android_external_e2fsprogs-38324e758b803e99419d24e16a00b32f8ebbf473.tar.bz2 android_external_e2fsprogs-38324e758b803e99419d24e16a00b32f8ebbf473.zip |
blkid: sanity check 'end' address must be greater than or equal to
'lable' address.
Avoid a potential out-of-bounds memory access address of label
Test: mma -j8 and boot devices
Change-Id: I155aa4e26f7079f517be3202de0032a86368559d
-rw-r--r-- | lib/blkid/probe.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 3bcf4c3d..865d9aa3 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -41,7 +41,7 @@ static int figure_label_len(const unsigned char *label, int len) { const unsigned char *end = label + len - 1; - while ((*end == ' ' || *end == 0) && end >= label) + while (end >= label && (*end == ' ' || *end == 0)) --end; if (end >= label) return end - label + 1; |