summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch')
-rw-r--r--meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch b/meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch
new file mode 100644
index 0000000000..92f65aa7cb
--- /dev/null
+++ b/meta/recipes-devtools/git/git-2.5.0/CVE-2016-2315_p2.patch
@@ -0,0 +1,89 @@
1From 8eee9f9277b6e38ec46c84f4ca3be5d988ca0a33 Mon Sep 17 00:00:00 2001
2From: Jeff King <peff@peff.net>
3Date: Thu, 11 Feb 2016 17:24:18 -0500
4Subject: [PATCH] show_object_with_name: simplify by using path_name()
5
6When "git rev-list" shows an object with its associated path
7name, it does so by walking the name_path linked list and
8printing each component (stopping at any embedded NULs or
9newlines).
10
11We'd like to eventually get rid of name_path entirely in
12favor of a single buffer, and dropping this custom printing
13code is part of that. As a first step, let's use path_name()
14to format the list into a single buffer, and print that.
15This is strictly less efficient than the original, but it's
16a temporary step in the refactoring; our end game will be to
17get the fully formatted name in the first place.
18
19Signed-off-by: Jeff King <peff@peff.net>
20Signed-off-by: Junio C Hamano <gitster@pobox.com>
21
22Upstream-Status: Backport
23CVE: CVE-2016-2315 patch2
24Signed-off-by: Armin Kuster <akuster@mvista.com>
25
26---
27 revision.c | 40 ++++++----------------------------------
28 1 file changed, 6 insertions(+), 34 deletions(-)
29
30diff --git a/revision.c b/revision.c
31index 0b322b4..cf544b6 100644
32--- a/revision.c
33+++ b/revision.c
34@@ -45,46 +45,18 @@ char *path_name(const struct name_path *path, const char *name)
35 return n;
36 }
37
38-static int show_path_component_truncated(FILE *out, const char *name, int len)
39-{
40- int cnt;
41- for (cnt = 0; cnt < len; cnt++) {
42- int ch = name[cnt];
43- if (!ch || ch == '\n')
44- return -1;
45- fputc(ch, out);
46- }
47- return len;
48-}
49-
50-static int show_path_truncated(FILE *out, const struct name_path *path)
51-{
52- int emitted, ours;
53-
54- if (!path)
55- return 0;
56- emitted = show_path_truncated(out, path->up);
57- if (emitted < 0)
58- return emitted;
59- if (emitted)
60- fputc('/', out);
61- ours = show_path_component_truncated(out, path->elem, path->elem_len);
62- if (ours < 0)
63- return ours;
64- return ours || emitted;
65-}
66-
67 void show_object_with_name(FILE *out, struct object *obj,
68 const struct name_path *path, const char *component)
69 {
70- struct name_path leaf;
71- leaf.up = (struct name_path *)path;
72- leaf.elem = component;
73- leaf.elem_len = strlen(component);
74+ char *name = path_name(path, component);
75+ char *p;
76
77 fprintf(out, "%s ", sha1_to_hex(obj->sha1));
78- show_path_truncated(out, &leaf);
79+ for (p = name; *p && *p != '\n'; p++)
80+ fputc(*p, out);
81 fputc('\n', out);
82+
83+ free(name);
84 }
85
86 static void mark_blob_uninteresting(struct blob *blob)
87--
882.7.4
89