From b96b2d65a3996fcfe281788a8949e5636be49408 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 8 Jul 2008 14:06:35 +0300 Subject: ubinize: validate number of sections Signed-off-by: Artem Bityutskiy --- ubi-utils/new-utils/src/ubinize.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ubi-utils/new-utils/src') diff --git a/ubi-utils/new-utils/src/ubinize.c b/ubi-utils/new-utils/src/ubinize.c index af26d14..f063b58 100644 --- a/ubi-utils/new-utils/src/ubinize.c +++ b/ubi-utils/new-utils/src/ubinize.c @@ -461,6 +461,14 @@ int main(int argc, char * const argv[]) goto out_dict; } + if (sects > ui.max_volumes) { + errmsg("too many sections (%d) in the ini-file \"%s\"", + sects, args.f_in); + normsg("each section corresponds to an UBI volume, maximum " + "count of volumes is %d", ui.max_volumes); + goto out_dict; + } + /* * Skip 2 PEBs at the beginning of the file for the volume table which * will be written later. @@ -523,11 +531,11 @@ int main(int argc, char * const argv[]) } /* - * Make sure the image size is not larger then the volume size. + * Make sure the image size is not larger than the volume size. */ if (st.st_size > vi.bytes) { errmsg("error in section \"%s\": size of the image file \"%s\" " - "is %lld, which is larger then the volume size %lld", + "is %lld, which is larger than the volume size %lld", sname, img, (long long)st.st_size, vi.bytes); goto out_dict; } -- cgit v1.2.3