qseecom: use strnlen in qseecom_start_app

The appname received by qseecom_start_app() can be non-null terminated
string beyond the max size check. Change strlen to strnlen.

CRs-fixed: 2062061
Change-Id: I845d244336b5c81cedb2153d1303585f16819d58
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
Zhen Kong 2017-06-16 11:55:07 -07:00 committed by Gerrit - the friendly Code Review server
parent 560a996da5
commit 70ca7ca60d

View file

@ -4379,9 +4379,9 @@ int qseecom_start_app(struct qseecom_handle **handle,
return -EINVAL; return -EINVAL;
} }
if (strlen(app_name) >= MAX_APP_NAME_SIZE) { if (strnlen(app_name, MAX_APP_NAME_SIZE) == MAX_APP_NAME_SIZE) {
pr_err("The app_name (%s) with length %zu is not valid\n", pr_err("The app_name (%s) with length %zu is not valid\n",
app_name, strlen(app_name)); app_name, strnlen(app_name, MAX_APP_NAME_SIZE));
return -EINVAL; return -EINVAL;
} }