]> err.no Git - linux-2.6/commitdiff
[SCTP]: Validate the parameter length in HB-ACK chunk.
authorVladislav Yasevich <vladislav.yasevich@hp.com>
Fri, 19 May 2006 21:25:53 +0000 (14:25 -0700)
committerSridhar Samudrala <sri@us.ibm.com>
Fri, 19 May 2006 21:25:53 +0000 (14:25 -0700)
If SCTP receives a badly formatted HB-ACK chunk, it is possible
that we may access invalid memory and potentially have a buffer
overflow.  We should really make sure that the chunk format is
what we expect, before attempting to touch the data.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
net/sctp/sm_statefuns.c

index 174f7a7c6cd1708ccdcdf31367c8a0018ae766da..8bc279219a72ca3b8e4e107eaeba562e87a79e4a 100644 (file)
@@ -1019,6 +1019,12 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
                                                  commands);
 
        hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
+       /* Make sure that the length of the parameter is what we expect */
+       if (ntohs(hbinfo->param_hdr.length) !=
+                                   sizeof(sctp_sender_hb_info_t)) {
+               return SCTP_DISPOSITION_DISCARD;
+       }
+
        from_addr = hbinfo->daddr;
        link = sctp_assoc_lookup_paddr(asoc, &from_addr);