aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Horvath <mark.horvath@arm.com>2021-11-09 07:53:51 +0100
committerDavid Hu <david.hu@arm.com>2021-11-17 11:51:01 +0100
commit78f75304269baf4fc349f1a2b687675e71d2955e (patch)
tree5ee43dd8591c26753d17ad3a23bea6df726db5d1
parent921d0eaa85595e9b992de866b9da8b0d7dfe08eb (diff)
downloadtrusted-firmware-m-78f7530.tar.gz
FWU: Refine the validation of the input argument
Signed-off-by: Mark Horvath <mark.horvath@arm.com> Co-authored-by: Sherry Zhang <sherry.zhang2@arm.com> Change-Id: If8dc03cd61e26669b47ae5a47c508835e08dadc4
-rw-r--r--secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c b/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
index 8c25aa4e8a..a379481af5 100644
--- a/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
+++ b/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
@@ -283,6 +283,10 @@ static psa_status_t tfm_fwu_write_ipc(void)
uint8_t image_index;
/* Check input parameters. */
+ if (msg.in_size[2] > sizeof(data_block)) {
+ return PSA_ERROR_INVALID_ARGUMENT;
+ }
+
if (msg.in_size[0] != sizeof(image_id) ||
msg.in_size[1] != sizeof(block_offset)) {
return PSA_ERROR_PROGRAMMER_ERROR;