mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
Don't access past end of cc_alg[] when trying to avoid
unregistering an invalid algorithm. CID 1453298 ok kettenis@ (with suggested improvements to come)
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: crypto.c,v 1.80 2017/11/30 16:31:12 visa Exp $ */
|
||||
/* $OpenBSD: crypto.c,v 1.81 2020/03/29 13:43:13 krw Exp $ */
|
||||
/*
|
||||
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
|
||||
*
|
||||
@@ -331,9 +331,9 @@ crypto_unregister(u_int32_t driverid, int alg)
|
||||
|
||||
/* Sanity checks. */
|
||||
if (driverid >= crypto_drivers_num || crypto_drivers == NULL ||
|
||||
((alg <= 0 || alg > CRYPTO_ALGORITHM_MAX) &&
|
||||
alg != CRYPTO_ALGORITHM_MAX + 1) ||
|
||||
crypto_drivers[driverid].cc_alg[alg] == 0) {
|
||||
alg <= 0 || alg > (CRYPTO_ALGORITHM_MAX + 1) ||
|
||||
(alg != (CRYPTO_ALGORITHM_MAX + 1) &&
|
||||
crypto_drivers[driverid].cc_alg[alg] == 0)) {
|
||||
splx(s);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user