Patch "sunrpc/cache: fix off-by-one in qword_get()" has been added to the 4.4-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
sunrpc/cache: fix off-by-one in qword_get()
to the 4.4-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:
sunrpc-cache-fix-off-by-one-in-qword_get.patch
and it can be found in the queue-4.4 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
b7052cd7bcf3c1478796e93e3dff2b44c9e82943Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <[email protected]>
Date: Thu, 18 Feb 2016 18:55:54 +0000
Subject: sunrpc/cache: fix off-by-one in qword_get()
From: Stefan Hajnoczi <[email protected]>
commit b7052cd7bcf3c1478796e93e3dff2b44c9e82943 upstream.
The qword_get() function NUL-terminates its output buffer. If the input string is in hex format \xXXXX... and the same length as the output buffer, there is an off-by-one:
int qword_get(char **bpp, char *dest, int bufsize)
{
...
while (len < bufsize) {
...
*dest++ = (h << 4) | l;
len++;
}
...
*dest = '\0';
return len;
}This patch ensures the NUL terminator doesn't fall outside the output buffer.
--- net/sunrpc/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/cache.c +1 -1
@@ -1225,7 +1225,7 @@ int qword_get(char **bpp, char *dest, inif (bp[0 ] =='\\' && bp[1 ] =='x' ) {/* HEX STRING */ bp +=2 ; -while (len < bufsize) { +while (len < bufsize -1 ) {int h, l; h =hex_to_bin (bp[0 ]);
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/sunrpc-cache-fix-off-by-one-in-qword_get.patch