Skip to contentSkip to conversation

Patch "staging: ncpfs: memory corruption in ncp_read_kernel()" has been added to the 3.18-stable tree

PATCH [email protected] 1 participant 1 message Mar 25, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: ncpfs: memory corruption in ncp_read_kernel()

to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
staging-ncpfs-memory-corruption-in-ncp_read_kernel.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 4c41aa24baa4ed338241d05494f2c595c885af8f Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Mon, 19 Mar 2018 14:07:45 +0300
Subject: staging: ncpfs: memory corruption in ncp_read_kernel()

From: Dan Carpenter <[email protected]>

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 Dr Silvio Cesare of InfoSect <Silvio Cesare <[email protected]>
Cc stable <[email protected]>
---
 fs/ncpfs/ncplib_kernel.c |    4 ++++
 1 file changed, 4 insertions(+)
fs/ncpfs/ncplib_kernel.c +4 -0
@@ -980,6 +980,10 @@ ncp_read_kernel(struct ncp_server *serve
 		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);

Patches currently in stable-queue which might be from [email protected] are

queue-3.18/staging-ncpfs-memory-corruption-in-ncp_read_kernel.patch