提交 f34d69c3 编写于 作者: I Insu Yun 提交者: Steve French

cifs: fix potential overflow in cifs_compose_mount_options

In worst case, "ip=" + sb_mountdata + ipv6 can be copied into mountdata.
Therefore, for safe, it is better to add more size when allocating memory.
Signed-off-by: NInsu Yun <wuninsu@gmail.com>
Signed-off-by: NSteve French <smfrench@gmail.com>
上级 997152f6
...@@ -175,7 +175,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata, ...@@ -175,7 +175,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
* string to the length of the original string to allow for worst case. * string to the length of the original string to allow for worst case.
*/ */
md_len = strlen(sb_mountdata) + INET6_ADDRSTRLEN; md_len = strlen(sb_mountdata) + INET6_ADDRSTRLEN;
mountdata = kzalloc(md_len + 1, GFP_KERNEL); mountdata = kzalloc(md_len + sizeof("ip=") + 1, GFP_KERNEL);
if (mountdata == NULL) { if (mountdata == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto compose_mount_options_err; goto compose_mount_options_err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册