tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
glibc: fix CVE-2014-5119 by Debian patch
Vladimír Čunát
11 years ago
a283bec7
60902b97
+207
2 changed files
expand all
collapse all
unified
split
pkgs
development
libraries
glibc
2.19
common.nix
cve-2014-5119.patch
+1
pkgs/development/libraries/glibc/2.19/common.nix
···
60
60
./fix-math.patch
61
61
62
62
./cve-2014-0475.patch
63
63
+
./cve-2014-5119.patch
63
64
];
64
65
65
66
postPatch = ''
+206
pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
···
1
1
+
http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/any/cvs-CVE-2014-5119.diff?revision=6248&view=co
2
2
+
3
3
+
commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8
4
4
+
Author: Florian Weimer <fweimer@redhat.com>
5
5
+
Date: Tue Aug 26 19:38:59 2014 +0200
6
6
+
7
7
+
__gconv_translit_find: Disable function [BZ #17187]
8
8
+
9
9
+
This functionality has never worked correctly, and the implementation
10
10
+
contained a security vulnerability (CVE-2014-5119).
11
11
+
12
12
+
2014-08-26 Florian Weimer <fweimer@redhat.com>
13
13
+
14
14
+
[BZ #17187]
15
15
+
* iconv/gconv_trans.c (struct known_trans, search_tree, lock,
16
16
+
trans_compare, open_translit, __gconv_translit_find):
17
17
+
Remove module loading code.
18
18
+
19
19
+
--- a/iconv/gconv_trans.c
20
20
+
+++ b/iconv/gconv_trans.c
21
21
+
@@ -238,181 +238,12 @@ __gconv_transliterate (struct __gconv_step *step,
22
22
+
return __GCONV_ILLEGAL_INPUT;
23
23
+
}
24
24
+
25
25
+
-
26
26
+
-/* Structure to represent results of found (or not) transliteration
27
27
+
- modules. */
28
28
+
-struct known_trans
29
29
+
-{
30
30
+
- /* This structure must remain the first member. */
31
31
+
- struct trans_struct info;
32
32
+
-
33
33
+
- char *fname;
34
34
+
- void *handle;
35
35
+
- int open_count;
36
36
+
-};
37
37
+
-
38
38
+
-
39
39
+
-/* Tree with results of previous calls to __gconv_translit_find. */
40
40
+
-static void *search_tree;
41
41
+
-
42
42
+
-/* We modify global data. */
43
43
+
-__libc_lock_define_initialized (static, lock);
44
44
+
-
45
45
+
-
46
46
+
-/* Compare two transliteration entries. */
47
47
+
-static int
48
48
+
-trans_compare (const void *p1, const void *p2)
49
49
+
-{
50
50
+
- const struct known_trans *s1 = (const struct known_trans *) p1;
51
51
+
- const struct known_trans *s2 = (const struct known_trans *) p2;
52
52
+
-
53
53
+
- return strcmp (s1->info.name, s2->info.name);
54
54
+
-}
55
55
+
-
56
56
+
-
57
57
+
-/* Open (maybe reopen) the module named in the struct. Get the function
58
58
+
- and data structure pointers we need. */
59
59
+
-static int
60
60
+
-open_translit (struct known_trans *trans)
61
61
+
-{
62
62
+
- __gconv_trans_query_fct queryfct;
63
63
+
-
64
64
+
- trans->handle = __libc_dlopen (trans->fname);
65
65
+
- if (trans->handle == NULL)
66
66
+
- /* Not available. */
67
67
+
- return 1;
68
68
+
-
69
69
+
- /* Find the required symbol. */
70
70
+
- queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
71
71
+
- if (queryfct == NULL)
72
72
+
- {
73
73
+
- /* We cannot live with that. */
74
74
+
- close_and_out:
75
75
+
- __libc_dlclose (trans->handle);
76
76
+
- trans->handle = NULL;
77
77
+
- return 1;
78
78
+
- }
79
79
+
-
80
80
+
- /* Get the context. */
81
81
+
- if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
82
82
+
- != 0)
83
83
+
- goto close_and_out;
84
84
+
-
85
85
+
- /* Of course we also have to have the actual function. */
86
86
+
- trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
87
87
+
- if (trans->info.trans_fct == NULL)
88
88
+
- goto close_and_out;
89
89
+
-
90
90
+
- /* Now the optional functions. */
91
91
+
- trans->info.trans_init_fct =
92
92
+
- __libc_dlsym (trans->handle, "gconv_trans_init");
93
93
+
- trans->info.trans_context_fct =
94
94
+
- __libc_dlsym (trans->handle, "gconv_trans_context");
95
95
+
- trans->info.trans_end_fct =
96
96
+
- __libc_dlsym (trans->handle, "gconv_trans_end");
97
97
+
-
98
98
+
- trans->open_count = 1;
99
99
+
-
100
100
+
- return 0;
101
101
+
-}
102
102
+
-
103
103
+
-
104
104
+
int
105
105
+
internal_function
106
106
+
__gconv_translit_find (struct trans_struct *trans)
107
107
+
{
108
108
+
- struct known_trans **found;
109
109
+
- const struct path_elem *runp;
110
110
+
- int res = 1;
111
111
+
-
112
112
+
- /* We have to have a name. */
113
113
+
- assert (trans->name != NULL);
114
114
+
-
115
115
+
- /* Acquire the lock. */
116
116
+
- __libc_lock_lock (lock);
117
117
+
-
118
118
+
- /* See whether we know this module already. */
119
119
+
- found = __tfind (trans, &search_tree, trans_compare);
120
120
+
- if (found != NULL)
121
121
+
- {
122
122
+
- /* Is this module available? */
123
123
+
- if ((*found)->handle != NULL)
124
124
+
- {
125
125
+
- /* Maybe we have to reopen the file. */
126
126
+
- if ((*found)->handle != (void *) -1)
127
127
+
- /* The object is not unloaded. */
128
128
+
- res = 0;
129
129
+
- else if (open_translit (*found) == 0)
130
130
+
- {
131
131
+
- /* Copy the data. */
132
132
+
- *trans = (*found)->info;
133
133
+
- (*found)->open_count++;
134
134
+
- res = 0;
135
135
+
- }
136
136
+
- }
137
137
+
- }
138
138
+
- else
139
139
+
- {
140
140
+
- size_t name_len = strlen (trans->name) + 1;
141
141
+
- int need_so = 0;
142
142
+
- struct known_trans *newp;
143
143
+
-
144
144
+
- /* We have to continue looking for the module. */
145
145
+
- if (__gconv_path_elem == NULL)
146
146
+
- __gconv_get_path ();
147
147
+
-
148
148
+
- /* See whether we have to append .so. */
149
149
+
- if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
150
150
+
- need_so = 1;
151
151
+
-
152
152
+
- /* Create a new entry. */
153
153
+
- newp = (struct known_trans *) malloc (sizeof (struct known_trans)
154
154
+
- + (__gconv_max_path_elem_len
155
155
+
- + name_len + 3)
156
156
+
- + name_len);
157
157
+
- if (newp != NULL)
158
158
+
- {
159
159
+
- char *cp;
160
160
+
-
161
161
+
- /* Clear the struct. */
162
162
+
- memset (newp, '\0', sizeof (struct known_trans));
163
163
+
-
164
164
+
- /* Store a copy of the module name. */
165
165
+
- newp->info.name = cp = (char *) (newp + 1);
166
166
+
- cp = __mempcpy (cp, trans->name, name_len);
167
167
+
-
168
168
+
- newp->fname = cp;
169
169
+
-
170
170
+
- /* Search in all the directories. */
171
171
+
- for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
172
172
+
- {
173
173
+
- cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
174
174
+
- trans->name, name_len);
175
175
+
- if (need_so)
176
176
+
- memcpy (cp, ".so", sizeof (".so"));
177
177
+
-
178
178
+
- if (open_translit (newp) == 0)
179
179
+
- {
180
180
+
- /* We found a module. */
181
181
+
- res = 0;
182
182
+
- break;
183
183
+
- }
184
184
+
- }
185
185
+
-
186
186
+
- if (res)
187
187
+
- newp->fname = NULL;
188
188
+
-
189
189
+
- /* In any case we'll add the entry to our search tree. */
190
190
+
- if (__tsearch (newp, &search_tree, trans_compare) == NULL)
191
191
+
- {
192
192
+
- /* Yickes, this should not happen. Unload the object. */
193
193
+
- res = 1;
194
194
+
- /* XXX unload here. */
195
195
+
- }
196
196
+
- }
197
197
+
- }
198
198
+
-
199
199
+
- __libc_lock_unlock (lock);
200
200
+
-
201
201
+
- return res;
202
202
+
+ /* Transliteration module loading has been removed because it never
203
203
+
+ worked as intended and suffered from a security vulnerability.
204
204
+
+ Consequently, this function always fails. */
205
205
+
+ return 1;
206
206
+
}