aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-08 14:06:35 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-08 15:29:04 +0300
commitb96b2d65a3996fcfe281788a8949e5636be49408 (patch)
tree31e355b686b37c2b478c8c2a383fa04c6b7a5d82 /ubi-utils
parent88730cb3f01f6b43f53faa3333f508ac9bc42916 (diff)
ubinize: validate number of sections
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/new-utils/src/ubinize.c12
1 files changed, 10 insertions, 2 deletions
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;
}