diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index 682e559..deead32 100644 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -906,6 +906,9 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag) unsigned int idx = 0; char *value; void *xipt = NULL; + static char *cx_names = "isofs.cx"; + static size_t cx_value_lengths[1] = {0}; + char *cx_valuept = ""; img= target->image; @@ -917,7 +920,12 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag) value= NULL; ret = iso_node_lookup_attr(node, "isofs.cx", &value_length, &value, 0); - if (ret == 1 && value_length == 4) { + if (ret == 1 && img->checksum_array == NULL) { + /* No checksum array loaded. Delete "isofs.cx" */ + iso_node_set_attrs(node, (size_t) 1, + &cx_names, cx_value_lengths, &cx_valuept, 4 | 8); + no_md5 = 1; + } else if (ret == 1 && value_length == 4) { for (i = 0; i < 4; i++) idx = (idx << 8) | ((unsigned char *) value)[i]; if (idx > 0 && idx < 0x8000000) { diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 7d70225..723bfb2 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -5241,14 +5241,6 @@ int iso_md5_end(void **md5_context, char result[16]); */ #define ISO_FILE_IMGPATH_WRONG 0xD020FF70 -/** - * Checksum array appears damaged and not trustworthy for verifications. - * (WARNING,HIGH, -145) - * @since 0.6.22 -*/ -#define ISO_MD5_ARRAY_CORRUPTED 0xD030FF6F - - /** * Offset greater than file size (FAILURE,HIGH, -150) * @since 0.6.4 @@ -5373,6 +5365,13 @@ int iso_md5_end(void **md5_context, char result[16]); /** Premature EOF of zlib input stream (FAILURE, HIGH, -351) */ #define ISO_ZLIB_EARLY_EOF 0xE830FEA1 +/** + * Checksum array appears damaged and not trustworthy for verifications. + * (WARNING,HIGH, -352) + * @since 0.6.22 +*/ +#define ISO_MD5_ARRAY_CORRUPTED 0xD030FEA0 + /* ! PLACE NEW ERROR CODES HERE ! */