putstr("peek: addr="); puthex32(p->addr);
printf(" bytes=%u\n", p->bytes);
- if (reply_payload_space < (sizeof(*r) + p->bytes)) {
+ if ((reply_payload_space < (sizeof(*r) + p->bytes)) ||
+ p->bytes > MAX_SUBPKT_LEN - sizeof(op_generic_t)) {
putstr("peek: insufficient reply packet space\n");
return 0; // FIXME do partial read?
}
* All subpackets are a multiple of 4 bytes long.
* All subpackets start with an 8-bit opcode, an 8-bit len and an 8-bit rid.
*/
-
+#define MAX_SUBPKT_LEN 252
/*!
* \brief Generic request and reply packet