All of lore.kernel.org
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: Steve Dickson <SteveD@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] Fix a buffer overflow in qword_add()
Date: Thu, 16 Apr 2020 17:34:53 -0400	[thread overview]
Message-ID: <20200416213453.80110-1-trondmy@kernel.org> (raw)

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


             reply	other threads:[~2020-04-16 21:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 21:34 trondmy [this message]
2020-05-08 14:10 ` [PATCH] Fix a buffer overflow in qword_add() Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200416213453.80110-1-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=SteveD@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.