提交 7bbb654e 编写于 作者: N Nicholas Bellinger

iscsi-target: Fix snprintf usage with MAX_PORTAL_LEN

This patch makes lio_target_call_addnptotpg() use sprintf() with
MAX_PORTAL_LEN + 1 to address the following smatch warning:

drivers/target/iscsi/iscsi_target_configfs.c +184 lio_target_call_addnptotpg(21)
        error: snprintf() chops off the last chars of 'name': 257 vs 256
Reported-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 76f1928e
......@@ -181,7 +181,7 @@ struct se_tpg_np *lio_target_call_addnptotpg(
return ERR_PTR(-EOVERFLOW);
}
memset(buf, 0, MAX_PORTAL_LEN + 1);
snprintf(buf, MAX_PORTAL_LEN, "%s", name);
snprintf(buf, MAX_PORTAL_LEN + 1, "%s", name);
memset(&sockaddr, 0, sizeof(struct __kernel_sockaddr_storage));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册