From: Yves Lefloch Date: Wed, 22 Mar 2017 16:14:07 +0000 (+0100) Subject: tee-supplicant: Report error on short buffer when loading TA X-Git-Tag: submit/tizen/20171011.123005~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39924684f4d5dca0d9f3756a9e780fce290c9faf;p=platform%2Fcore%2Fsecurity%2Ftef-optee_client.git tee-supplicant: Report error on short buffer when loading TA Change-Id: Ie1a2a514e302d387d063f5a03cabee944fb4765a Signed-off-by: Yves Lefloch Acked-by: Jerome Forissier Reviewed-by: Etienne Carriere Reviewed-by: Jens Wiklander Signed-off-by: Rafal Tyminski --- diff --git a/tee-supplicant/src/tee_supplicant.c b/tee-supplicant/src/tee_supplicant.c index 9258c47..dc710df 100644 --- a/tee-supplicant/src/tee_supplicant.c +++ b/tee-supplicant/src/tee_supplicant.c @@ -341,6 +341,14 @@ static uint32_t load_ta(size_t num_params, struct tee_ioctl_param *params) } params[1].u.memref.size = size; + + /* + * If a buffer wasn't provided, just tell which size it should be. + * If it was provided but isn't big enough, report an error. + */ + if (shm_ta.buffer && size > shm_ta.size) + return TEEC_ERROR_SHORT_BUFFER; + return TEEC_SUCCESS; }