Skip to contentSkip to conversation

possible integer underflow in __sctp_auth_cid()

DISCUSSION Dan Carpenter 1 participant 1 message Jun 30, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

In 555d3d5d "SCTP: Fix chunk acceptance when no authenticated chunks were listed.", we added a check for if (param->param_hdr.length = 0). Shouldn't that check be a check for if (param->param_hdr.length < sizeos(sizeof(sctp_paramhdr_t)))? Otherwise, when we do the substraction on the next line we would unintentionally end up with a high positive number.

I had a similar question about sctp_auth_ep_add_chunkid():

net/sctp/auth.c

   770          /* Check if we can add this chunk to the array */
   771          param_len = ntohs(p->param_hdr.length);
   772          nchunks = param_len - sizeof(sctp_paramhdr_t);
   773          if (nchunks = SCTP_NUM_CHUNK_TYPES)

774 return -EINVAL;
775
776 p->chunks[nchunks] = chunk_id;

If param_len is less than sizeof(sctp_paramhdr_t) we could write past the end of the array. There are a couple other places with this same subtraction as well.

regards,
dan carpenter