crypto: Fix possible stack out of bound error

Adding fix to check upper limit on the length
of the destination array while copying elements from
source address to avoid stack out of bound error.

Change-Id: Ieb24e8f9b4a2b53fbc9442b25d790b12f737d471
Signed-off-by: Tanwee Kausar <tkausar@codeaurora.org>
Issue: SEC-2931
(cherry picked from commit 4e921964bd0686950cd89eca69e77a5f3f109d3a)
2 files changed