From: Jeff Layton <jlayton@kernel.org>
To: chuck.lever@oracle.com
Cc: kernel-tls-handshake@lists.linux.dev,
Steve Dickson <steved@redhat.com>, Petr Pisar <ppisar@redhat.com>
Subject: [PATCH] tlshd: fix max config file size comparison
Date: Tue, 20 Jun 2023 13:20:14 -0400 [thread overview]
Message-ID: <20230620172014.1178395-1-jlayton@kernel.org> (raw)
gcc throws a warning on 32-bit x86 because of signedness mismatch:
config.c:155:52: error: comparison of integer expressions of different signedness: '__off_t' {aka 'long int'} and 'unsigned int' [-Werror=sign-compare]
155 | if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) {
| ^
st_size is a signed value (off_t), but UINT_MAX is unsigned.
Change it to compare against INT_MAX instead. This technically cuts the
max size of the config file in half to only 2GB, but I don't think we'll
miss it.
Cc: Steve Dickson <steved@redhat.com>
Reported-by: Petr Pisar <ppisar@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
src/tlshd/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tlshd/config.c b/src/tlshd/config.c
index 87cc4018733b..bdab98b9fba4 100644
--- a/src/tlshd/config.c
+++ b/src/tlshd/config.c
@@ -152,7 +152,7 @@ static bool tlshd_config_read_datum(const char *pathname, gnutls_datum_t *data,
tlshd_log_perror("stat");
goto out_close;
}
- if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) {
+ if (statbuf.st_size < 0 || statbuf.st_size > INT_MAX) {
tlshd_log_error("Bad config file size: %lld", statbuf.st_size);
goto out_close;
}
--
2.41.0
next reply other threads:[~2023-06-20 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 17:20 Jeff Layton [this message]
2023-06-20 17:42 ` [PATCH] tlshd: fix max config file size comparison Chuck Lever III
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=20230620172014.1178395-1-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=kernel-tls-handshake@lists.linux.dev \
--cc=ppisar@redhat.com \
--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