aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-01-20 17:06:15 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-01-20 17:06:15 +0100
commit5fc90cb84eec5f5493a8ea2136f9e36b68357e96 (patch)
treeb546285ddd9e7ad644cc98a97ccc3c7e7d20b5b1 /src
parentea4b06c9f3b114d90a193e4cbc64cc08ba57a27f (diff)
downloadexternal_libqmi-5fc90cb84eec5f5493a8ea2136f9e36b68357e96.zip
external_libqmi-5fc90cb84eec5f5493a8ea2136f9e36b68357e96.tar.gz
external_libqmi-5fc90cb84eec5f5493a8ea2136f9e36b68357e96.tar.bz2
qmi-firware-update: image size 0 is invalid
Diffstat (limited to 'src')
-rw-r--r--src/qmi-firmware-update/qfu-image-cwe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qmi-firmware-update/qfu-image-cwe.c b/src/qmi-firmware-update/qfu-image-cwe.c
index a0631de..f76afda 100644
--- a/src/qmi-firmware-update/qfu-image-cwe.c
+++ b/src/qmi-firmware-update/qfu-image-cwe.c
@@ -421,6 +421,12 @@ load_image_info (QfuImageCwe *self,
return FALSE;
}
+ /* No image size reported */
+ if (!info.hdr.imgsize) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "invalid image size");
+ return FALSE;
+ }
+
/* Check limits of the current image */
image_end_offset = image_start_offset + GUINT32_FROM_BE (info.hdr.imgsize) + sizeof (QfuCweFileHeader);
if (parent_image_end_offset > 0 && parent_image_end_offset < image_end_offset) {