about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2016-01-16 11:03:06 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2016-01-17 17:05:19 +0100
commit3fbfced7401cfcbb8006a9a6ce4add6b37a41a55 (patch)
treeba068905ab00c96c3528783649467c4b3b8aad65
parentui-log: handle parse_commit() errors (diff)
downloadcgit-pink-3fbfced7401cfcbb8006a9a6ce4add6b37a41a55.tar.gz
cgit-pink-3fbfced7401cfcbb8006a9a6ce4add6b37a41a55.zip
cache: use size_t for string lengths
Avoid integer truncation on 64-bit systems.

Coverity-id: 13864
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to '')
-rw-r--r--cache.c4
1 files 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)
ill kick in, so if you search for the same string again, it'll show an empty range, so you have to change the bogus strings each time. This is because we just pass the arguments straight to Git's revision parsing machinery which die()s if it cannot parse an argument, printing the above to stderr and exiting. The patch below makes it a bit friendlier by just ignoring unhandled arguments, but I can't see an easy way to report errors when we can't parse revision arguments without losing the flexibility of supporting all of the revision specifiers supported by Git. Reported-by: Konstantin Ryabitsev <mricon@kernel.org> 2014-06-28git: update for git 2.0Christian Hesse prefixcmp() and suffixcmp() have been remove, functionality is now provided by starts_with() and ends_with(). Retrurn values have been changed, so instead of just renaming we have to fix logic. Everything else looks just fine. 2014-04-17remove trailing whitespaces from source filesChristian Hesse 2014-04-12git: update to 1.9.2Christian Hesse Everything works just bumping the version in Makefile and commit hash in submodule. No code changes required. 2014-04-05Fix cgit_parse_url when a repo url is contained in another repo urlJulian Maurice For example, if I have two repos (remove-suffix is enabled): /foo /foo/bar http://cgit/foo/bar/ is interpreted as "repository 'foo', command 'bar'" instead of "repository 'foo/bar'" 2014-03-20Makefile: use more reliable git tarball mirrorJason A. Donenfeld 2014-03-20git: update to 1.9.1Christian Hesse