Commit 5e7124c4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

staging: ncpfs: memory corruption in ncp_read_kernel()

commit 4c41aa24baa4ed338241d05494f2c595c885af8f upstream.

If the server is malicious then *bytes_read could be larger than the
size of the "target" buffer.  It would lead to memory corruption when we
do the memcpy().
Reported-by: default avatarDr Silvio Cesare of InfoSect &lt;Silvio Cesare <>
Signed-off-by: default avatarDan Carpenter <>
Cc: stable <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 4d9ed688
......@@ -980,6 +980,10 @@ ncp_read_kernel(struct ncp_server *server, const char *file_id,
goto out;
*bytes_read = ncp_reply_be16(server, 0);
if (*bytes_read > to_read) {
result = -EINVAL;
goto out;
source = ncp_reply_data(server, 2 + (offset & 1));
memcpy(target, source, *bytes_read);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment