Although we checked on each round of subpackets that we were still
within the correct length, we weren't checking the subpacket length
itself fit within the remaining data. Fixes some issues found using
American Fuzzy Lop.
packetlen <<= 8;
packetlen |= data[offset++];
}
+ /* Check the supplied length is within the remaining data */
+ if (packetlen == 0 || (packetlen + offset) > length) {
+ return ONAK_E_INVALID_PKT;
+ }
switch (data[offset] & 0x7F) {
case OPENPGP_SIGSUB_CREATION:
/*