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:
parent
687826e83e
commit
adb13b7d65
1 changed files with 1 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue