Linux NFS development
 help / color / mirror / Atom feed
From: Zhi Li <yieli@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: steved@redhat.com, Zhi Li <yieli@redhat.com>
Subject: [PATCH] [nfs/nfs-utils] rpcdebug: avoid buffer underflow if read() returns 0
Date: Thu,  9 Mar 2023 14:20:25 +0800	[thread overview]
Message-ID: <20230309062025.731671-1-yieli@redhat.com> (raw)

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2176740

Signed-off-by: Zhi Li <yieli@redhat.com>
---
 tools/rpcdebug/rpcdebug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/rpcdebug/rpcdebug.c b/tools/rpcdebug/rpcdebug.c
index 68206cc5..ec05179e 100644
--- a/tools/rpcdebug/rpcdebug.c
+++ b/tools/rpcdebug/rpcdebug.c
@@ -257,7 +257,7 @@ get_flags(char *module)
 		perror(filename);
 		exit(1);
 	}
-	if ((len = read(sysfd, buffer, sizeof(buffer))) < 0) {
+	if ((len = read(sysfd, buffer, sizeof(buffer))) <= 0) {
 		perror("read");
 		exit(1);
 	}
-- 
2.39.0


             reply	other threads:[~2023-03-09  6:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  6:20 Zhi Li [this message]
2023-04-05 16:28 ` [PATCH] [nfs/nfs-utils] rpcdebug: avoid buffer underflow if read() returns 0 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=20230309062025.731671-1-yieli@redhat.com \
    --to=yieli@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox