Skip to contentSkip to conversation

Fix a buffer overflow in qword_add()

PATCH In review [email protected] 2 participants 2 messages Apr 16, 2020 – May 8, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 Fix a buffer overflow in qword_add()

From: Trond Myklebust <[email protected]>

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

---
 support/nfs/cacheio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/nfs/cacheio.c +1 -1
index 126c12831668..70ead94d64f0 100644
@@ -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':
Signature · 1 line
2.25.2
#1 lore raw
Quoted 5 lines · On 4/16/20 5:34 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

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

Committed... (tag: nfs-utils-2-4-4-rc4)

steved.

Quoted 18 lines
---
 support/nfs/cacheio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/nfs/cacheio.c +1 -1
index 126c12831668..70ead94d64f0 100644
@@ -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':