diff mbox series

Fix a buffer overflow in qword_add()

Message ID 20200416213453.80110-1-trondmy@kernel.org (mailing list archive)
State New, archived
Headers show
Series Fix a buffer overflow in qword_add() | expand

Commit Message

Trond Myklebust April 16, 2020, 9:34 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

Don't allow writing beyond the end of the buffer.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 support/nfs/cacheio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve Dickson May 8, 2020, 2:10 p.m. UTC | #1
On 4/16/20 5:34 PM, trondmy@kernel.org wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> Don't allow writing beyond the end of the buffer.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Committed... (tag: nfs-utils-2-4-4-rc4)

steved.

> ---
>  support/nfs/cacheio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
> index 126c12831668..70ead94d64f0 100644
> --- a/support/nfs/cacheio.c
> +++ b/support/nfs/cacheio.c
> @@ -42,7 +42,7 @@ void qword_add(char **bpp, int *lp, char *str)
>  
>  	if (len < 0) return;
>  
> -	while ((c=*str++) && len)
> +	while ((c=*str++) && len > 0)
>  		switch(c) {
>  		case ' ':
>  		case '\t':
>
diff mbox series

Patch

diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
index 126c12831668..70ead94d64f0 100644
--- a/support/nfs/cacheio.c
+++ b/support/nfs/cacheio.c
@@ -42,7 +42,7 @@  void qword_add(char **bpp, int *lp, char *str)
 
 	if (len < 0) return;
 
-	while ((c=*str++) && len)
+	while ((c=*str++) && len > 0)
 		switch(c) {
 		case ' ':
 		case '\t':