Do not allow segment with size set to 0.

This commit is contained in:
Ondrej Kozina
2018-07-30 14:16:49 +02:00
committed by Milan Broz
parent c1777cfb89
commit dfeb5cfdd2

View File

@@ -598,7 +598,7 @@ static int hdr_validate_segments(json_object *hdr_jobj)
/* size "dynamic" means whole device starting at 'offset' */
if (strcmp(json_object_get_string(jobj_size), "dynamic")) {
if (!numbered("size", json_object_get_string(jobj_size)) ||
!json_str_to_uint64(jobj_size, &size))
!json_str_to_uint64(jobj_size, &size) || !size)
return 1;
} else
size = 0;