Commit 95d92a1b authored by Alessandro Rubini's avatar Alessandro Rubini

bugfix: we can't check 0-size frames

bug introduced in

   cc014e83 fsm: centralize checks on the frame
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d17cb001
......@@ -174,8 +174,9 @@ static int type_length[__PP_NR_MESSAGES_TYPES] = {
static int fsm_unpack_verify_frame(struct pp_instance *ppi,
uint8_t *packet, int plen)
{
int msgtype;
int msgtype = 0;
if (plen)
msgtype = packet[0] & 0xf;
if (msgtype >= __PP_NR_MESSAGES_TYPES || plen < type_length[msgtype])
return 1; /* too short */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment