[BZ #9781]
authorUlrich Drepper <drepper@redhat.com>
Sat, 7 Feb 2009 04:40:57 +0000 (04:40 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 7 Feb 2009 04:40:57 +0000 (04:40 +0000)
* grp/compat-initgroups.c (compat_call): Switch to use malloc when
the input line is too long.

ChangeLog
grp/compat-initgroups.c
localedata/ChangeLog
localedata/locales/el_CY
localedata/locales/el_GR
resolv/res_libc.c

index 4c9a9b10d4d9f041b1c8720d3a7bf20c5e58affa..7dbb800b3fe7de31cae7f686322f1a6993a34bdd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-02-06  Ulrich Drepper  <drepper@redhat.com>
 
+       [BZ #9781]
+       * grp/compat-initgroups.c (compat_call): Switch to use malloc when
+       the input line is too long.
+
        * po/Makefile (libc.pot): Add f_print as function taking c-format
        parameter.
 
index efd875a6897ab4affb3ff12c5a4c511eedce3a12..374f42a0dc53f353590af0136044787357447e31 100644 (file)
@@ -14,7 +14,6 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
 {
   struct group grpbuf;
   size_t buflen = __sysconf (_SC_GETGR_R_SIZE_MAX);
-  char *tmpbuf;
   enum nss_status status;
   set_function setgrent_fct;
   get_function getgrent_fct;
@@ -35,7 +34,9 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
 
   endgrent_fct = __nss_lookup_function (nip, "endgrent");
 
-  tmpbuf = __alloca (buflen);
+  char *tmpbuf = __alloca (buflen);
+  bool use_malloc = false;
+  enum nss_status result = NSS_STATUS_SUCCESS;
 
   do
     {
@@ -44,8 +45,20 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
              status == NSS_STATUS_TRYAGAIN)
             && *errnop == ERANGE)
         {
-          buflen *= 2;
-          tmpbuf = __alloca (buflen);
+         if (__libc_use_alloca (buflen * 2))
+           tmpbuf = extend_alloca (tmpbuf, buflen, buflen * 2);
+         else
+           {
+             buflen *= 2;
+             char *newbuf = realloc (use_malloc ? tmpbuf : NULL, buflen);
+             if (newbuf == NULL)
+               {
+                 result = NSS_STATUS_TRYAGAIN;
+                 goto done;
+               }
+             use_malloc = true;
+             tmpbuf = newbuf;
+           }
         }
 
       if (status != NSS_STATUS_SUCCESS)
@@ -102,8 +115,11 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
   while (status == NSS_STATUS_SUCCESS);
 
  done:
+  if (use_malloc)
+    free (tmpbuf);
+
   if (endgrent_fct)
     DL_CALL_FCT (endgrent_fct, ());
 
-  return NSS_STATUS_SUCCESS;
+  return result;
 }
index c748d0d704b8f0a5aecd0d4bb7d5170e104f7ccc..12e7e68982db36d956c02dd312f88382ded1e574 100644 (file)
@@ -1,3 +1,10 @@
+2009-02-06  Ulrich Drepper  <drepper@redhat.com>
+
+       [BZ #9736]
+       * locales/el_CY: Fix frac_digits and int_frac_digits.
+       * locales/el_GR: Likewise.
+       Patch by Clint Adams <schizo@debian.org>.
+
 2009-01-28  Ulrich Drepper  <drepper@redhat.com>
 
        [BZ #9791]
index 7213924233910458a26317c75a87578b640924c8..31175777ed9749bb49aea09b01680430c72ce1c4 100644 (file)
@@ -51,8 +51,8 @@ mon_thousands_sep     "<U002E>"
 mon_grouping          3
 positive_sign         ""
 negative_sign         "<U002D>"
-int_frac_digits       4
-frac_digits           4
+int_frac_digits       2
+frac_digits           2
 p_cs_precedes         0
 p_sep_by_space        0
 n_cs_precedes         1
index ce608a801e83c0ea7fb11cbfff48674a4f707ba1..bb1db143f3fad8ccf56bade4c8dfba412e379346 100644 (file)
@@ -70,8 +70,8 @@ mon_thousands_sep     "<U002E>"
 mon_grouping          3
 positive_sign         ""
 negative_sign         "<U002D>"
-int_frac_digits       4
-frac_digits           4
+int_frac_digits       2
+frac_digits           2
 p_cs_precedes         0
 p_sep_by_space        0
 n_cs_precedes         1
index 8af57f7a4a429771482cccb434917b9dd6f8e24f..810fbc804d8bc008b271f7f31318fa42ad34b69b 100644 (file)
@@ -96,10 +96,9 @@ __res_maybe_init (res_state resp, int preinit)
 {
        if (resp->options & RES_INIT) {
                if (__res_initstamp != resp->_u._ext.initstamp) {
-                       if (resp->nscount > 0) {
+                       if (resp->nscount > 0)
                                __res_iclose (resp, true);
-                               return __res_vinit (resp, 1);
-                       }
+                       return __res_vinit (resp, 1);
                }
                return 0;
        } else if (preinit) {