]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* nscd/nscd_gethst_r.c (nscd_gethst_r): Set *h_errnop to
authorUlrich Drepper <drepper@redhat.com>
Mon, 21 Feb 2005 23:43:21 +0000 (23:43 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 21 Feb 2005 23:43:21 +0000 (23:43 +0000)
NETDB_INTERNAL if buffer is too small.

* nscd/hstcache.c (INCR): Remove.
(addhstbyX): Double buflen in each iteration rather than add INCR.
* nscd/grpcache.c: Likewise.
* nscd/pwdcache.c: Likewise.

ChangeLog
nscd/grpcache.c
nscd/hstcache.c
nscd/nscd_gethst_r.c
nscd/pwdcache.c

index c828841de53965c09c779b26ab68c29e98bb76cd..2425840c3262e34a19afc690354ea012d750c02c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-02-21  Jakub Jelinek  <jakub@redhat.com>
+
+       * nscd/nscd_gethst_r.c (nscd_gethst_r): Set *h_errnop to
+       NETDB_INTERNAL if buffer is too small.
+
+       * nscd/hstcache.c (INCR): Remove.
+       (addhstbyX): Double buflen in each iteration rather than add INCR.
+       * nscd/grpcache.c: Likewise.
+       * nscd/pwdcache.c: Likewise.
+
 2005-02-21  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/libc_fatal.c: Print backtrace and memory
index c565f5a68278232252b079c19ffd901ee6dee61f..ed84d92120dbb3758edbc6574d66a5eefd66c4c0 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for group lookup.
-   Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -429,11 +429,10 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
     {
       char *old_buffer = buffer;
       errno = 0;
-#define INCR 1024
 
       if (__builtin_expect (buflen > 32768, 0))
        {
-         buflen += INCR;
+         buflen *= 2;
          buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
          if (buffer == NULL)
            {
@@ -454,7 +453,7 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
       else
        /* Allocate a new buffer on the stack.  If possible combine it
           with the previously allocated buffer.  */
-       buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
+       buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
     }
 
 #if 0
index 99d2998f49b9534f064fe6829ddc064a3dabce60..a18860a53dda87a9fa8b9247476a09d1c64455a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -453,11 +453,10 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
     {
       char *old_buffer = buffer;
       errno = 0;
-#define INCR 1024
 
       if (__builtin_expect (buflen > 32768, 0))
        {
-         buflen += INCR;
+         buflen *= 2;
          buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
          if (buffer == NULL)
            {
@@ -478,7 +477,7 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
       else
        /* Allocate a new buffer on the stack.  If possible combine it
           with the previously allocated buffer.  */
-       buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
+       buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
     }
 
 #if 0
index 5d9d569107a8f43c74bea9898e52f0b01a2c46bb..ef27e68735e016f9a0d71357380b809d2b29a7c7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -218,6 +218,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
                                                   ? INADDRSZ : IN6ADDRSZ)))
        {
        no_room:
+         *h_errnop = NETDB_INTERNAL;
          __set_errno (ERANGE);
          retval = ERANGE;
          goto out_close;
index e8b9578778dbf06bc3d2cd473ec366fd953aa22d..b67b0f2b435c397fd160ec7cc844caa0808a5bb7 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for passwd lookup.
-   Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -425,11 +425,10 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
     {
       char *old_buffer = buffer;
       errno = 0;
-#define INCR 1024
 
       if (__builtin_expect (buflen > 32768, 0))
        {
-         buflen += INCR;
+         buflen *= 2;
          buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
          if (buffer == NULL)
            {
@@ -450,7 +449,7 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
       else
        /* Allocate a new buffer on the stack.  If possible combine it
           with the previously allocated buffer.  */
-       buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
+       buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
     }
 
 #if 0