提交 232ebe34 编写于 作者: D Dan Carpenter 提交者: Nicholas Bellinger

target/usb-gadget: strlen() doesn't count the terminator

We need to take the terminator into consideration here or the last
character gets silently truncated away later.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 8ecf595b
......@@ -1815,7 +1815,7 @@ static ssize_t tcm_usbg_tpg_store_nexus(
ret = tcm_usbg_drop_nexus(tpg);
return (!ret) ? count : ret;
}
if (strlen(page) > USBG_NAMELEN) {
if (strlen(page) >= USBG_NAMELEN) {
pr_err("Emulated NAA Sas Address: %s, exceeds"
" max: %d\n", page, USBG_NAMELEN);
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册