diff options
Diffstat (limited to 'include/net/sctp/sctp.h')
-rw-r--r-- | include/net/sctp/sctp.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index a9519a06a23b..980807d7506f 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -469,6 +469,8 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) | |||
469 | 469 | ||
470 | #define _sctp_walk_params(pos, chunk, end, member)\ | 470 | #define _sctp_walk_params(pos, chunk, end, member)\ |
471 | for (pos.v = chunk->member;\ | 471 | for (pos.v = chunk->member;\ |
472 | (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <\ | ||
473 | (void *)chunk + end) &&\ | ||
472 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ | 474 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ |
473 | ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\ | 475 | ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\ |
474 | pos.v += SCTP_PAD4(ntohs(pos.p->length))) | 476 | pos.v += SCTP_PAD4(ntohs(pos.p->length))) |
@@ -479,6 +481,8 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
479 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 481 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
480 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 482 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
481 | sizeof(struct sctp_chunkhdr));\ | 483 | sizeof(struct sctp_chunkhdr));\ |
484 | ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <\ | ||
485 | (void *)chunk_hdr + end) &&\ | ||
482 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 486 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
483 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 487 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
484 | err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) | 488 | err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) |