[SCTP]: Respect the real chunk length when walking parameters. (CVE-2006-1858)
Linux Kernel Mailing List <[email protected]> Tue, 20 Jun 2006 14:59:01 GMT
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
commit 11b2b42abac0225dd4cc71e8dbf9336a7b344cee tree 9cc39e55cb849a028e39c2a636cf4d5400756fa4 parent 478afbe1b9b1c3c6f2ddadac6876e1479d792758 author Vlad Yasevich <[email protected]> Tue, 20 Jun 2006 12:57:28 -0700 committer David S. Miller <[email protected]> Tue, 20 Jun 2006 12:57:28 -0700 [SCTP]: Respect the real chunk length when walking parameters. (CVE-2006-1858) When performing bound checks during the parameter processing, we want to use the real chunk and paramter lengths for bounds instead of the rounded ones. This prevents us from potentially walking of the end if the chunk length was miscalculated. We still use rounded lengths when advancing the pointer. This was found during a conformance test that changed the chunk length without modifying parameters. Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: Sridhar Samudrala <[email protected]> Signed-off-by: David S. Miller <[email protected]> include/net/sctp/sctp.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 643f925..0e01fef 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -466,12 +466,12 @@ static inline int sctp_frag_point(const * there is room for a param header too. */ #define sctp_walk_params(pos, chunk, member)\ -_sctp_walk_params((pos), (chunk), WORD_ROUND(ntohs((chunk)->chunk_hdr.length)), member) +_sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) #define _sctp_walk_params(pos, chunk, end, member)\ for (pos.v = chunk->member;\ pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ - pos.v <= (void *)chunk + end - WORD_ROUND(ntohs(pos.p->length)) &&\ + pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ pos.v += WORD_ROUND(ntohs(pos.p->length))) @@ -482,7 +482,7 @@ #define _sctp_walk_errors(err, chunk_hdr for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ sizeof(sctp_chunkhdr_t));\ (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ - (void *)err <= (void *)chunk_hdr + end - WORD_ROUND(ntohs(err->length)) &&\ + (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ ntohs(err->length) >= sizeof(sctp_errhdr_t); \ err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length))))