Fix #6987 - fix oob in entitlements mach

This commit is contained in:
alvarofe 2017-03-12 23:02:00 +01:00
parent 6413d0a0f4
commit 2884b117f0

View File

@ -593,8 +593,12 @@ static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) {
bin->signature = calloc (1, len + 1);
if (bin->signature) {
ut8 *src = bin->b->buf + off + sizeof (struct blob_t);
memcpy (bin->signature, src, len);
bin->signature[len] = '\0';
if (off + sizeof (struct blob_t) + len < bin->b->length) {
memcpy (bin->signature, src, len);
bin->signature[len] = '\0';
return true;
}
bin->signature = (ut8 *)strdup ("Malformed entitlement");
return true;
}
} else {