mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-07 09:41:30 +00:00
DM: using 'strncpy' coding style cleanup
- check buffer boundaries to avoid buffer overflow Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
@@ -922,7 +922,7 @@ basl_make_templates(void)
|
||||
len = strlen(tmpdir);
|
||||
|
||||
if ((len + sizeof(ASL_TEMPLATE) + 1) < MAXPATHLEN) {
|
||||
strncpy(basl_template, tmpdir, len);
|
||||
strncpy(basl_template, tmpdir, len + 1);
|
||||
while (len > 0 && basl_template[len - 1] == '/')
|
||||
len--;
|
||||
basl_template[len] = '/';
|
||||
@@ -937,7 +937,7 @@ basl_make_templates(void)
|
||||
*/
|
||||
if ((len + sizeof(ASL_TEMPLATE) + 1 +
|
||||
sizeof(ASL_SUFFIX)) < MAXPATHLEN) {
|
||||
strncpy(basl_stemplate, tmpdir, len);
|
||||
strncpy(basl_stemplate, tmpdir, len + 1);
|
||||
basl_stemplate[len] = '/';
|
||||
strncpy(&basl_stemplate[len + 1], ASL_TEMPLATE,
|
||||
MAXPATHLEN - len - 1);
|
||||
|
||||
Reference in New Issue
Block a user