]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh848082.patch
glibc: Update patchset.
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh848082.patch
1 commit 4f031072a5055abd83717820b59efdaa463d5853
2 Author: Ulrich Drepper <drepper@gmail.com>
3 Date: Sat May 28 16:59:30 2011 -0400
4
5 Handle failure of _nl_explode_name in all cases
6
7 2011-05-28 Ulrich Drepper <drepper@gmail.com>
8
9 * locale/findlocale.c (_nl_find_locale): Return right away if
10 _nl_explode_name failed.
11 * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
12
13 diff --git a/locale/findlocale.c b/locale/findlocale.c
14 index 6b88c96..2fec9a7 100644
15 --- a/locale/findlocale.c
16 +++ b/locale/findlocale.c
17 @@ -1,4 +1,4 @@
18 -/* Copyright (C) 1996-2001, 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
19 +/* Copyright (C) 1996-2003, 2006, 2010, 2011 Free Software Foundation, Inc.
20 This file is part of the GNU C Library.
21 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
22
23 @@ -140,6 +140,9 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
24 */
25 mask = _nl_explode_name (loc_name, &language, &modifier, &territory,
26 &codeset, &normalized_codeset);
27 + if (mask == -1)
28 + /* Memory allocate problem. */
29 + return NULL;
30
31 /* If exactly this locale was already asked for we have an entry with
32 the complete name. */
33 diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
34 index 85ba77d..e95bcf1 100644
35 --- a/locale/programs/locarchive.c
36 +++ b/locale/programs/locarchive.c
37 @@ -1,4 +1,4 @@
38 -/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
39 +/* Copyright (C) 2002,2003,2005,2007,2009,2011 Free Software Foundation, Inc.
40 This file is part of the GNU C Library.
41 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
42
43 @@ -1079,6 +1079,8 @@ add_locale_to_archive (ah, name, data, replace)
44 int mask = _nl_explode_name (strdupa (name),
45 &language, &modifier, &territory,
46 &codeset, &normalized_codeset);
47 + if (mask == -1)
48 + return -1;
49
50 if (mask & XPG_NORM_CODESET)
51 /* This name contains a codeset in unnormalized form.
52 @@ -1128,6 +1130,7 @@ add_locale_to_archive (ah, name, data, replace)
53
54 /* Now read the locale.alias files looking for lines whose
55 right hand side matches our name after normalization. */
56 + int result = 0;
57 if (alias_file != NULL)
58 {
59 FILE *fp;
60 @@ -1207,6 +1210,11 @@ add_locale_to_archive (ah, name, data, replace)
61 &rhs_territory,
62 &rhs_codeset,
63 &rhs_normalized_codeset);
64 + if (rhs_mask == 1)
65 + {
66 + result = -1;
67 + goto out;
68 + }
69 if (!strcmp (language, rhs_language)
70 && ((rhs_mask & XPG_CODESET)
71 /* He has a codeset, it must match normalized. */
72 @@ -1240,6 +1248,7 @@ add_locale_to_archive (ah, name, data, replace)
73 }
74 }
75
76 + out:
77 fclose (fp);
78 }
79
80 @@ -1248,7 +1257,7 @@ add_locale_to_archive (ah, name, data, replace)
81 if (mask & XPG_NORM_CODESET)
82 free ((char *) normalized_codeset);
83
84 - return 0;
85 + return result;
86 }
87
88