Made read_aaip_AA() safe against eventual Apple ISO AA fields
This commit is contained in:
parent
cd427b269a
commit
183ed6cc5a
@ -1332,6 +1332,11 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* >>> AAIP-2 :
|
||||||
|
SUSP_SIG(sue, 'A', 'L')
|
||||||
|
read_aaip_AL() like read_aaip_AA()
|
||||||
|
*/
|
||||||
|
|
||||||
/* This message is inflationary */
|
/* This message is inflationary */
|
||||||
/*
|
/*
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,6 +125,9 @@ struct rr_AA {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* >>> AAIP-2 : struct rr_AL like struct rr_AA */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Struct for a SUSP System User Entry (SUSP, 4.1)
|
* Struct for a SUSP System User Entry (SUSP, 4.1)
|
||||||
*/
|
*/
|
||||||
@ -145,6 +148,8 @@ struct susp_sys_user_entry
|
|||||||
struct rr_SL SL;
|
struct rr_SL SL;
|
||||||
struct rr_AA AA;
|
struct rr_AA AA;
|
||||||
|
|
||||||
|
/* >>> AAIP-2 : struct rr_AL */
|
||||||
|
|
||||||
} data; /* 5 to 4+len_sue */
|
} data; /* 5 to 4+len_sue */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -442,15 +442,40 @@ int read_aaip_AA(struct susp_sys_user_entry *sue,
|
|||||||
unsigned char *aapt;
|
unsigned char *aapt;
|
||||||
|
|
||||||
if (*is_done) {
|
if (*is_done) {
|
||||||
|
|
||||||
|
/* AAIP-2
|
||||||
|
To coexist with Apple ISO :
|
||||||
|
Gracefully react on eventually trailing Apple AA
|
||||||
|
*/
|
||||||
|
if (sue->version[0] != 1 || sue->len_sue[0] == 7)
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
return ISO_WRONG_RR;
|
return ISO_WRONG_RR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Eventually create or grow storage */
|
/* Eventually create or grow storage */
|
||||||
if (*aa_size == 0 || *aa_string == NULL) {
|
if (*aa_size == 0 || *aa_string == NULL) {
|
||||||
|
|
||||||
|
/* AAIP-2
|
||||||
|
Gracefully react on eventually leading Apple AA
|
||||||
|
*/
|
||||||
|
if (sue->version[0] != 1 || sue->len_sue[0] < 9) {
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
*aa_size = *aa_len + sue->len_sue[0];
|
*aa_size = *aa_len + sue->len_sue[0];
|
||||||
*aa_string = calloc(*aa_size, 1);
|
*aa_string = calloc(*aa_size, 1);
|
||||||
*aa_len = 0;
|
*aa_len = 0;
|
||||||
} else if (*aa_len + sue->len_sue[0] > *aa_size) {
|
} else if (*aa_len + sue->len_sue[0] > *aa_size) {
|
||||||
|
|
||||||
|
if (sue->version[0] != 1) {
|
||||||
|
/* AAIP-2
|
||||||
|
Apple ISO within the AAIP field group is not AAIP compliant
|
||||||
|
*/
|
||||||
|
return ISO_WRONG_RR;
|
||||||
|
}
|
||||||
|
|
||||||
*aa_size += *aa_len + sue->len_sue[0];
|
*aa_size += *aa_len + sue->len_sue[0];
|
||||||
*aa_string = realloc(*aa_string, *aa_size);
|
*aa_string = realloc(*aa_string, *aa_size);
|
||||||
}
|
}
|
||||||
@ -466,8 +491,13 @@ int read_aaip_AA(struct susp_sys_user_entry *sue,
|
|||||||
|
|
||||||
/* Compose new SUSP header with signature aa[], cont == 0 */
|
/* Compose new SUSP header with signature aa[], cont == 0 */
|
||||||
aapt = *aa_string + *aa_len;
|
aapt = *aa_string + *aa_len;
|
||||||
|
|
||||||
|
/* >>> AAIP-2
|
||||||
|
Change to new signature (AL ?)
|
||||||
|
*/
|
||||||
aapt[0] = 'A';
|
aapt[0] = 'A';
|
||||||
aapt[1] = 'A';
|
aapt[1] = 'A';
|
||||||
|
|
||||||
aapt[2] = sue->len_sue[0];
|
aapt[2] = sue->len_sue[0];
|
||||||
aapt[3] = 1;
|
aapt[3] = 1;
|
||||||
aapt[4] = 0;
|
aapt[4] = 0;
|
||||||
@ -480,3 +510,7 @@ int read_aaip_AA(struct susp_sys_user_entry *sue,
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* >>> AAIP-2
|
||||||
|
read_aaip_AL() like read_aaip_AA()
|
||||||
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user