diff options
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.patch | 89 |
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 @@ | |||
1 | From 8eee9f9277b6e38ec46c84f4ca3be5d988ca0a33 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jeff King <peff@peff.net> | ||
3 | Date: Thu, 11 Feb 2016 17:24:18 -0500 | ||
4 | Subject: [PATCH] show_object_with_name: simplify by using path_name() | ||
5 | |||
6 | When "git rev-list" shows an object with its associated path | ||
7 | name, it does so by walking the name_path linked list and | ||
8 | printing each component (stopping at any embedded NULs or | ||
9 | newlines). | ||
10 | |||
11 | We'd like to eventually get rid of name_path entirely in | ||
12 | favor of a single buffer, and dropping this custom printing | ||
13 | code is part of that. As a first step, let's use path_name() | ||
14 | to format the list into a single buffer, and print that. | ||
15 | This is strictly less efficient than the original, but it's | ||
16 | a temporary step in the refactoring; our end game will be to | ||
17 | get the fully formatted name in the first place. | ||
18 | |||
19 | Signed-off-by: Jeff King <peff@peff.net> | ||
20 | Signed-off-by: Junio C Hamano <gitster@pobox.com> | ||
21 | |||
22 | Upstream-Status: Backport | ||
23 | CVE: CVE-2016-2315 patch2 | ||
24 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
25 | |||
26 | --- | ||
27 | revision.c | 40 ++++++---------------------------------- | ||
28 | 1 file changed, 6 insertions(+), 34 deletions(-) | ||
29 | |||
30 | diff --git a/revision.c b/revision.c | ||
31 | index 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 | -- | ||
88 | 2.7.4 | ||
89 | |||