fs: shell: fix broken duplication of mount point path

Existing code wrote NUL to the end of the source string, rather than
the copy.

See https://habr.com/en/company/pvs-studio/blog/495284/ fragment 5.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-04-05 11:16:58 -05:00 committed by Anas Nashif
commit adb13b7d65

View file

@ -423,8 +423,7 @@ static char *mntpt_prepare(char *mntpt)
cpy_mntpt = k_malloc(strlen(mntpt) + 1); cpy_mntpt = k_malloc(strlen(mntpt) + 1);
if (cpy_mntpt) { if (cpy_mntpt) {
((u8_t *)mntpt)[strlen(mntpt)] = '\0'; strcpy(cpy_mntpt, mntpt);
memcpy(cpy_mntpt, mntpt, strlen(mntpt));
} }
return cpy_mntpt; return cpy_mntpt;
} }