Skip to content

Commit

Permalink
Fix the check for updating an SCTP-AUTH key.
Browse files Browse the repository at this point in the history
This bug could result in a use-after-free situation. Thanks
to 邵大成 <[email protected]>
for reporting the issue.
  • Loading branch information
tuexen committed Sep 17, 2019
1 parent 7e28028 commit c00245f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions netinet/sctp_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 339042 2018-10-01 14:05:31Z tuexen $");
__FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 352438 2019-09-17 09:46:42Z tuexen $");

#endif

#include <netinet/sctp_os.h>
Expand Down Expand Up @@ -525,7 +526,7 @@ sctp_insert_sharedkey(struct sctp_keyhead *shared_keys,
} else if (new_skey->keyid == skey->keyid) {
/* replace the existing key */
/* verify this key *can* be replaced */
if ((skey->deactivated) && (skey->refcount > 1)) {
if ((skey->deactivated) || (skey->refcount > 1)) {
SCTPDBG(SCTP_DEBUG_AUTH1,
"can't replace shared key id %u\n",
new_skey->keyid);
Expand Down

0 comments on commit c00245f

Please sign in to comment.