]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sctp: Fix out-of-bounds reading in sctp_asoc_get_hmac()
authorDan Rosenberg <drosenberg@vsecurity.com>
Fri, 1 Oct 2010 11:51:47 +0000 (11:51 +0000)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:16:17 +0000 (16:16 -0400)
commit799c3ec501854be3d6be56c1db5452e2e8371ef4
tree581590754ef5800423786144a80a1ae0e7ad19a3
parenteef557db3e67f4897c21423d4f2d41392458aa9c
sctp: Fix out-of-bounds reading in sctp_asoc_get_hmac()

commit 51e97a12bef19b7e43199fc153cf9bd5f2140362 upstream

The sctp_asoc_get_hmac() function iterates through a peer's hmac_ids
array and attempts to ensure that only a supported hmac entry is
returned.  The current code fails to do this properly - if the last id
in the array is out of range (greater than SCTP_AUTH_HMAC_ID_MAX), the
id integer remains set after exiting the loop, and the address of an
out-of-bounds entry will be returned and subsequently used in the parent
function, causing potentially ugly memory corruption.  This patch resets
the id integer to 0 on encountering an invalid id so that NULL will be
returned after finishing the loop if no valid ids are found.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/sctp/auth.c