dm: hw: Replace strlen with strnlen

Replace strlen function with strnlen function in device-model

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Long Liu
2018-12-12 07:24:53 +00:00
committed by wenlingz
parent eab7cd47ae
commit 63b814e7e9
2 changed files with 3 additions and 2 deletions

View File

@@ -1006,7 +1006,7 @@ basl_make_templates(void)
tmpdir = _PATH_TMP;
}
len = strlen(tmpdir);
len = strnlen(tmpdir, MAXPATHLEN);
if ((len + sizeof(ASL_TEMPLATE) + 1) < MAXPATHLEN) {
strncpy(basl_template, tmpdir, len + 1);