X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fxml.c;h=6233462c9ca53bc590549e8c8d3d093d1a49b436;hb=9521348eebfb0e91c9c9567f58fe6a7adca49f06;hp=9ef6f65f12cdc7be084a4bcdf231f45fb45cd686;hpb=d58c611b1eb1ea971576443fd45becca816168d2;p=wimlib diff --git a/src/xml.c b/src/xml.c index 9ef6f65f..6233462c 100644 --- a/src/xml.c +++ b/src/xml.c @@ -572,8 +572,9 @@ xml_read_wim_info(const xmlNode *wim_node, struct wim_info **wim_info_ret) num_images = 0; for_node_child(wim_node, child) { if (node_is_element(child) && node_name_is(child, "IMAGE")) { - if (num_images == INT_MAX) { - return WIMLIB_ERR_IMAGE_COUNT; + if (unlikely(num_images == MAX_IMAGES)) { + ret = WIMLIB_ERR_IMAGE_COUNT; + goto err; } num_images++; } @@ -623,7 +624,8 @@ xml_read_wim_info(const xmlNode *wim_node, struct wim_info **wim_info_ret) ERROR("WIM images are not indexed [1...%d] " "in XML data as expected", num_images); - return WIMLIB_ERR_IMAGE_COUNT; + ret = WIMLIB_ERR_IMAGE_COUNT; + goto err; } } @@ -1575,7 +1577,7 @@ write_wim_xml_data(WIMStruct *wim, int image, u64 total_bytes, size_t xml_len; DEBUG("Writing WIM XML data (image=%d, offset=%"PRIu64")", - image, total_bytes, wim->out_fd.offset); + image, wim->out_fd.offset); ret = prepare_wim_xml_data(wim, image, total_bytes, &xml_data, &xml_len);