]> 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)
committerMike Frysinger <vapier@gentoo.org>
Sat, 12 Nov 2016 05:44:22 +0000 (00:44 -0500)
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)
(cherry picked from commit 28a87e027450b66faf1a431fc62779297c760e29)

nss/nss_db/db-XXX.c

index 03c18d70de65bbca30b037f5d4068781e27408f0..125a5e9b12616c345eaa14471d033a4ad307db96 100644 (file)
@@ -288,8 +288,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;
            }