diff options
author | tuexen <tuexen@FreeBSD.org> | 2012-09-07 13:36:42 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2012-09-07 13:36:42 +0000 |
commit | 001c4aa6c4c64ee9584fbef16f7b2626cf58c41f (patch) | |
tree | 2b50fc66148c3a4c3c7d753a1a47f53a85ada046 | |
parent | 8c350d556986bd03d0410ee97f632c768c05d5b7 (diff) | |
download | FreeBSD-src-001c4aa6c4c64ee9584fbef16f7b2626cf58c41f.zip FreeBSD-src-001c4aa6c4c64ee9584fbef16f7b2626cf58c41f.tar.gz |
Don't include a structure containing a flexible array in another
structure.
MFC after: 10 days
-rw-r--r-- | sys/netinet/sctp_header.h | 10 | ||||
-rw-r--r-- | sys/netinet/sctp_indata.c | 2 | ||||
-rw-r--r-- | sys/netinet/sctp_input.c | 19 | ||||
-rw-r--r-- | sys/netinet/sctp_input.h | 2 | ||||
-rw-r--r-- | sys/netinet/sctp_structs.h | 4 |
5 files changed, 13 insertions, 24 deletions
diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h index a26e9b4..8f898a4 100644 --- a/sys/netinet/sctp_header.h +++ b/sys/netinet/sctp_header.h @@ -510,16 +510,6 @@ struct sctp_stream_reset_add_strm { * streams then the request will need to be an overlay structure. */ -struct sctp_stream_reset_out_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_out_request sr_req; -} SCTP_PACKED; - -struct sctp_stream_reset_in_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_in_request sr_req; -} SCTP_PACKED; - struct sctp_stream_reset_tsn_req { struct sctp_chunkhdr ch; struct sctp_stream_reset_tsn_request sr_req; diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 45936dc..ac776a8 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -2113,7 +2113,7 @@ finish_express_del: */ struct sctp_queued_to_read *ctl, *nctl; - sctp_reset_in_stream(stcb, liste->number_entries, liste->req.list_of_streams); + sctp_reset_in_stream(stcb, liste->number_entries, liste->list_of_streams); TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); SCTP_FREE(liste, SCTP_M_STRESET); /* sa_ignore FREED_MEMORY */ diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index b3a551c..36aabfd 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -3455,9 +3455,9 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, } void -sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, uint16_t * list) +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) { - int i; + uint32_t i; uint16_t temp; /* @@ -3511,7 +3511,7 @@ struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; - struct sctp_stream_reset_out_req *req; + struct sctp_chunkhdr *ch; struct sctp_stream_reset_out_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3534,8 +3534,8 @@ sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chu *bchk = chk; } clen = chk->send_size; - req = mtod(chk->data, struct sctp_stream_reset_out_req *); - r = &req->sr_req; + ch = mtod(chk->data, struct sctp_chunkhdr *); + r = (struct sctp_stream_reset_out_request *)(ch + 1); if (ntohl(r->request_seq) == seq) { /* found it */ return (r); @@ -3888,8 +3888,7 @@ sctp_handle_str_reset_request_out(struct sctp_tcb *stcb, } liste->tsn = tsn; liste->number_entries = number_entries; - memcpy(&liste->req, req, - (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t)))); + memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t)); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } @@ -4059,7 +4058,7 @@ __attribute__((noinline)) #endif static int sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, - struct sctp_stream_reset_out_req *sr_req) + struct sctp_chunkhdr *ch_req) { int chk_length, param_len, ptype; struct sctp_paramhdr pstore; @@ -4074,7 +4073,7 @@ __attribute__((noinline)) int num_param = 0; /* now it may be a reset or a reset-response */ - chk_length = ntohs(sr_req->ch.chunk_length); + chk_length = ntohs(ch_req->chunk_length); /* setup for adding the response */ sctp_alloc_a_chunk(stcb, chk); @@ -5413,7 +5412,7 @@ process_control_chunks: */ stcb->asoc.peer_supports_strreset = 1; } - if (sctp_handle_stream_reset(stcb, m, *offset, (struct sctp_stream_reset_out_req *)ch)) { + if (sctp_handle_stream_reset(stcb, m, *offset, ch)) { /* stop processing */ *offset = length; return (NULL); diff --git a/sys/netinet/sctp_input.h b/sys/netinet/sctp_input.h index 9b91ec6..9520803 100644 --- a/sys/netinet/sctp_input.h +++ b/sys/netinet/sctp_input.h @@ -53,7 +53,7 @@ sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk); void -sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list); diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 4bd0ca9..b344e91 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -77,8 +77,8 @@ TAILQ_HEAD(sctpnetlisthead, sctp_nets); struct sctp_stream_reset_list { TAILQ_ENTRY(sctp_stream_reset_list) next_resp; uint32_t tsn; - int number_entries; - struct sctp_stream_reset_out_request req; + uint32_t number_entries; + uint16_t list_of_streams[]; }; TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); |