From 7cde5885d8ce53359ee665bb930b1da956e8369a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 28 Aug 2018 18:11:50 +0200 Subject: parsing: ban strncpy() Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse --- parsing.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'parsing.c') diff --git a/parsing.c b/parsing.c index 12453c2..e224564 100644 --- a/parsing.c +++ b/parsing.c @@ -63,8 +63,7 @@ static char *substr(const char *head, const char *tail) if (tail < head) return xstrdup(""); buf = xmalloc(tail - head + 1); - strncpy(buf, head, tail - head); - buf[tail - head] = '\0'; + strlcpy(buf, head, tail - head + 1); return buf; } -- cgit v1.2.3-24-g4f1b From 60a930044d57faae4fcb84cba9d85310b0c767a7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 28 Aug 2018 18:14:32 +0200 Subject: parsing: ban sprintf() Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse --- parsing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parsing.c') diff --git a/parsing.c b/parsing.c index e224564..9e73e70 100644 --- a/parsing.c +++ b/parsing.c @@ -77,7 +77,7 @@ static void parse_user(const char *t, char **name, char **email, unsigned long * email_len = ident.mail_end - ident.mail_begin; *email = xmalloc(strlen("<") + email_len + strlen(">") + 1); - sprintf(*email, "<%.*s>", email_len, ident.mail_begin); + xsnprintf(*email, email_len + 3, "<%.*s>", email_len, ident.mail_begin); if (ident.date_begin) *date = strtoul(ident.date_begin, NULL, 10); -- cgit v1.2.3-24-g4f1b From 2c9f56f3e1c754f60ccffbc6c745b9d5a81ea005 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 28 Aug 2018 18:27:00 +0200 Subject: git: update to v2.19.1 Update to git version v2.19.1. Required changes follow upstream commits: * commit: add repository argument to get_cached_commit_buffer (3ce85f7e5a41116145179f0fae2ce6d86558d099) * commit: add repository argument to lookup_commit_reference (2122f6754c93be8f02bfb5704ed96c88fc9837a8) * object: add repository argument to parse_object (109cd76dd3467bd05f8d2145b857006649741d5c) * tag: add repository argument to deref_tag (a74093da5ed601a09fa158e5ba6f6f14c1142a3e) * tag: add repository argument to lookup_tag (ce71efb713f97f476a2d2ab541a0c73f684a5db3) * tree: add repository argument to lookup_tree (f86bcc7b2ce6cad68ba1a48a528e380c6126705e) * archive.c: avoid access to the_index (b612ee202a48f129f81f8f6a5af6cf71d1a9caef) * for_each_*_object: move declarations to object-store.h (0889aae1cd18c1804ba01c1a4229e516dfb9fe9b) Signed-off-by: Christian Hesse --- parsing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parsing.c') diff --git a/parsing.c b/parsing.c index 9e73e70..7b3980e 100644 --- a/parsing.c +++ b/parsing.c @@ -129,7 +129,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) { const int sha1hex_len = 40; struct commitinfo *ret; - const char *p = get_cached_commit_buffer(commit, NULL); + const char *p = get_cached_commit_buffer(the_repository, commit, NULL); const char *t; ret = xcalloc(1, sizeof(struct commitinfo)); -- cgit v1.2.3-24-g4f1b From bfabd4519c80f39eedba3dd5d522563899e364c9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 23 Oct 2019 23:21:54 +0200 Subject: git: update to v2.24.0 Update to git version v2.24.0. Never use get_cached_commit_buffer() directly, use repo_get_commit_buffer() instead. The latter calls the former anyway. This fixes segmentation fault when commit-graph is enabled and get_cached_commit_buffer() does not return the expected result. Signed-off-by: Christian Hesse --- parsing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parsing.c') diff --git a/parsing.c b/parsing.c index 7b3980e..93b4767 100644 --- a/parsing.c +++ b/parsing.c @@ -129,7 +129,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) { const int sha1hex_len = 40; struct commitinfo *ret; - const char *p = get_cached_commit_buffer(the_repository, commit, NULL); + const char *p = repo_get_commit_buffer(the_repository, commit, NULL); const char *t; ret = xcalloc(1, sizeof(struct commitinfo)); -- cgit v1.2.3-24-g4f1b