summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 21:06:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-25 17:18:18 (GMT)
commit48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b (patch)
tree67e3469fd97096b0f49c91600abbedea8208931a /cache.h
parent330c8e26701c33f1d74dbe3c2692f29b5ed4ba5f (diff)
downloadgit-48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b.zip
git-48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b.tar.gz
git-48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b.tar.bz2
add_packed_git: convert strcpy into xsnprintf
We have the path "foo.idx", and we create a buffer big enough to hold "foo.pack" and "foo.keep", and then strcpy straight into it. This isn't a bug (we have enough space), but it's very hard to tell from the strcpy that this is so. Let's instead use strip_suffix to take off the ".idx", record the size of our allocation, and use xsnprintf to make sure we don't violate our assumptions. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 030b880..d206d64 100644
--- a/cache.h
+++ b/cache.h
@@ -1309,7 +1309,7 @@ extern void close_pack_windows(struct packed_git *);
extern void unuse_pack(struct pack_window **);
extern void free_pack_by_name(const char *);
extern void clear_delta_base_cache(void);
-extern struct packed_git *add_packed_git(const char *, int, int);
+extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
/*
* Return the SHA-1 of the nth object within the specified packfile.