From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 2/3] cache: use size_t for string lengths
Date: Sat, 16 Jan 2016 11:03:06 +0000 [thread overview]
Message-ID: <f984a52c9dd6964357a58b91b715e9d0431325f0.1452942146.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1452942146.git.john@keeping.me.uk>
Avoid integer truncation on 64-bit systems.
Coverity-id: 13864
Signed-off-by: John Keeping <john at keeping.me.uk>
---
cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cache.c b/cache.c
index b169d20..df1b4a3 100644
--- a/cache.c
+++ b/cache.c
@@ -24,7 +24,7 @@
struct cache_slot {
const char *key;
- int keylen;
+ size_t keylen;
int ttl;
cache_fill_fn fn;
int cache_fd;
@@ -44,7 +44,7 @@ struct cache_slot {
static int open_slot(struct cache_slot *slot)
{
char *bufz;
- int bufkeylen = -1;
+ ssize_t bufkeylen = -1;
slot->cache_fd = open(slot->cache_name, O_RDONLY);
if (slot->cache_fd == -1)
--
2.7.0.226.gfe986fe
next prev parent reply other threads:[~2016-01-16 11:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-16 11:03 [PATCH 0/3] Fix some issues found by Coverity john
2016-01-16 11:03 ` [PATCH 1/3] ui-log: handle parse_commit() errors john
2016-01-16 11:03 ` john [this message]
2016-01-16 11:03 ` [PATCH 3/3] cache: don't check for match with no key john
2016-01-17 16:04 ` [PATCH 0/3] Fix some issues found by Coverity Jason
2016-01-17 16:19 ` Jason
2016-01-17 20:25 ` john
2016-02-03 4:46 ` mathstuf
2016-02-08 13:35 ` Jason
2016-02-08 14:16 ` john
2016-02-08 14:33 ` Jason
2016-02-08 16:31 ` john
2016-02-08 17:26 ` Jason
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=f984a52c9dd6964357a58b91b715e9d0431325f0.1452942146.git.john@keeping.me.uk \
--to=cgit@lists.zx2c4.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;
as well as URLs for NNTP newsgroup(s).