From 8426db93097fe57259f5a36fe51e41edf96177a5 Mon Sep 17 00:00:00 2001 From: Qi Yadong Date: Thu, 13 Jun 2019 12:08:47 +0800 Subject: [PATCH] DM: vrpmb: replace assert() with return false Replace assert() with explicit parameter checking and error handling. Tracked-On: #3252 Signed-off-by: Qi Yadong Acked-by: Zhu Bing --- devicemodel/core/vrpmb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devicemodel/core/vrpmb.c b/devicemodel/core/vrpmb.c index ec693768c..910c53287 100644 --- a/devicemodel/core/vrpmb.c +++ b/devicemodel/core/vrpmb.c @@ -56,7 +56,10 @@ int get_vrpmb_key(uint8_t *out, size_t size) return 0; } - assert(size == RPMB_KEY_LEN); + if (size != RPMB_KEY_LEN) { + fprintf(stderr, "%s: Invalid input key size\n", __func__); + return 0; + } if ( vrkey.initialized == false ) { for (i = 0; i < DRNG_MAX_RETRIES; i++) {