Fix Coverity Issue
3351934. Calling strncpy() with the size shorter
than the source string and would cause null-terminate dest buffer.
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I1e71fb584eb8f10a90ec87564cc49b7f9388c3de
(cherry picked from commit
0c408158af2592f34ed4ecc7c6a30db5c8676ffe)
}
static inline int encrypt_lock_store(FbLockState lock, unsigned char* bdata) {
if (FASTBOOT_LOCK == lock)
- strncpy((char *)bdata, "locked", strlen("locked"));
+ strncpy((char *)bdata, "locked", strlen("locked") + 1);
else if (FASTBOOT_UNLOCK == lock)
- strncpy((char *)bdata, "unlocked", strlen("unlocked"));
+ strncpy((char *)bdata, "unlocked", strlen("unlocked") + 1);
else
return -1;
return 0;