summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhi Li <yieli@redhat.com>2023-04-05 12:08:10 -0400
committerSteve Dickson <steved@redhat.com>2023-04-05 12:25:17 -0400
commita746c35822e557766d1871ec976490a71e6962d9 (patch)
treec85f77a1e83b8fa30487b8bd905ebe14387acc02
parent5faf98a62843d1cda2a0fe15e0878fa1281e42b8 (diff)
downloadnfs-utils-a746c35822e557766d1871ec976490a71e6962d9.tar.gz
rpcdebug: avoid buffer underflow if read() returns 0
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2176740 Signed-off-by: Zhi Li <yieli@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--tools/rpcdebug/rpcdebug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/rpcdebug/rpcdebug.c b/tools/rpcdebug/rpcdebug.c
index 68206cc..ec05179 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);
}