lib/mpi: fix off-by-one check on index "no"
PATCH 1/1 lib/mpi: fix off-by-one check on index "no"
From: Colin Ian King <[email protected]>
There is an off-by-one range check on the upper limit of index "no". Fix this by changing the > comparison to >
Addresses-Coverity: ("Out-of-bounds read")
Fixes a8ea8bdd9df9 ("lib/mpi: Extend the MPI library")
Signed-off-by Colin Ian King <[email protected]>
--- lib/mpi/mpiutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mpi/mpiutil.c +1 -1
@@ -69,7 +69,7 @@ postcore_initcall(mpi_init);*/ MPI mpi_const (enum gcry_mpi_constants no) { -if ((int )no <0 || no >MPI_NUMBER_OF_CONSTANTS ) +if ((int )no <0 || no >=MPI_NUMBER_OF_CONSTANTS )pr_err ("MPI: invalid mpi_const selector %d\n" , no);if (!constants[no])pr_err ("MPI: MPI subsystem not initialized\n" );
Signature · 1 line
2.27.0
Quoted 10 lines · Colin King
From: Colin Ian King <[email protected]>
There is an off-by-one range check on the upper limit of index "no". Fix this by changing the > comparison to >>
Addresses-Coverity: ("Out-of-bounds read")Fixes a8ea8bdd9df9 ("lib/mpi: Extend the MPI library")Signed-off-by Colin Ian King <[email protected]>--- lib/mpi/mpiutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Could you resend this with a cc to linux-crypto?
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt