summaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-pow.c
diff options
context:
space:
mode:
authorNicolai Stange <nicstange@gmail.com>2016-03-22 13:12:42 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-04-05 20:35:49 +0800
commit462696fd0fd2aae2fd38d22d19b2d08a55606014 (patch)
treeec9191a5ed4157b3b372f43cea44374df5369c54 /lib/mpi/mpi-pow.c
parent90f864e20029600a8dc33e27b1192af4636100d4 (diff)
downloadop-kernel-dev-462696fd0fd2aae2fd38d22d19b2d08a55606014.zip
op-kernel-dev-462696fd0fd2aae2fd38d22d19b2d08a55606014.tar.gz
lib/mpi: mpi_read_buffer(): fix buffer overflow
Currently, mpi_read_buffer() writes full limbs to the output buffer and moves memory around to purge leading zero limbs afterwards. However, with commit 9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for the integer") the caller is only required to provide a buffer large enough to hold the result without the leading zeros. This might result in a buffer overflow for small MP numbers with leading zeros. Fix this by coping the result to its final destination within the output buffer and not copying the leading zeros at all. Fixes: 9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for the integer") Signed-off-by: Nicolai Stange <nicstange@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'lib/mpi/mpi-pow.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud