From: Dmitry Kasatkin Date: Thu, 26 Jan 2012 17:13:22 +0000 (+0200) Subject: lib/mpi: checks for zero divisor length X-Git-Tag: v3.3~236^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2fe85c236736c866481de288f636ab06ef49787;p=platform%2Fkernel%2Flinux-amlogic.git lib/mpi: checks for zero divisor length Divisor length should not be 0. Signed-off-by: Dmitry Kasatkin Reviewed-by: Tetsuo Handa Signed-off-by: James Morris --- diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c index c3087d1..8a45717 100644 --- a/lib/mpi/mpi-div.c +++ b/lib/mpi/mpi-div.c @@ -149,6 +149,9 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) mpi_ptr_t marker[5]; int markidx = 0; + if (!dsize) + return -EINVAL; + memset(marker, 0, sizeof(marker)); /* Ensure space is enough for quotient and remainder.