]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nss_db: Propagate ERANGE error if parse_line fails [BZ #19837]
authorFlorian Weimer <fweimer@redhat.com>
Tue, 29 Mar 2016 09:27:32 +0000 (11:27 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 18 Aug 2016 13:26:21 +0000 (15:26 +0200)
Reproducer (needs to run as root):

perl -e \
  'print "large:x:999:" . join(",", map {"user$_"} (1 .. 135))."\n"' \
  >> /etc/group
cd /var/db
make
getent -s db group

After the fix, the last command should list the "large" group.

The magic number 135 has been chosen so that the line is shorter than
1024 bytes, but the pointers required to encode the member array will
cross the threshold, triggering the bug.

(cherry picked from commit a6033052d08027f745867e5e346852da1959226c)

ChangeLog
nss/nss_db/db-XXX.c

index bb8d618de90d69c699b49f5f3796b6ce9219fe1b..84d847e2af6950b8388e58fee4a7bbd94c8caf32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-29  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #19837]
+       * nss/nss_db/db-XXX.c (_nss_db_getENTNAME_r): Propagate ERANGE
+       error if parse_line fails.
+
 2016-06-11  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #20237]
index 70b58bee42eae9960a205993a358bdc23a45c60c..e13287aa81d8b64477d2d7dbd2a75c8e29b43229 100644 (file)
@@ -294,8 +294,8 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
            }
          if (err < 0)
            {
-             H_ERRNO_SET (HOST_NOT_FOUND);
-             status = NSS_STATUS_NOTFOUND;
+             H_ERRNO_SET (NETDB_INTERNAL);
+             status = NSS_STATUS_TRYAGAIN;
              break;
            }