All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix a buffer overflow in qword_add()
@ 2020-04-16 21:34 trondmy
  2020-05-08 14:10 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: trondmy @ 2020-04-16 21:34 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs

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(-)

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':
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-08 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 21:34 [PATCH] Fix a buffer overflow in qword_add() trondmy
2020-05-08 14:10 ` Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.