aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubinize.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-24 12:00:02 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-24 12:00:02 +0200
commit7c3f709388d1fcecad658d4166a4b16845fc4451 (patch)
tree1f2627e09c239c52ab4c3f9c76a725516add7d6a /ubi-utils/src/ubinize.c
parent7534823b150820cf156b6928086d84d588740035 (diff)
ubi-utils: check image file size in ubinize
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/ubinize.c')
-rw-r--r--ubi-utils/src/ubinize.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ubi-utils/src/ubinize.c b/ubi-utils/src/ubinize.c
index df82e0b..e36c3ba 100644
--- a/ubi-utils/src/ubinize.c
+++ b/ubi-utils/src/ubinize.c
@@ -570,6 +570,16 @@ int main(int argc, char * const argv[])
goto out_dict;
}
+ /*
+ * Make sure the image size is not larger then 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",
+ sname, img, (long long)st.st_size, vi.bytes);
+ goto out_dict;
+ }
+
f = fopen(img, "r");
if (!f) {
errmsg("cannot open \"%s\"", img);