aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-03-29 11:27:32 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-08-18 15:26:21 +0200
commit240ceafed7a00af8571d56db67a6b8854e418106 (patch)
treec83a99cfac8a34c1a38fd5bc233d13ad5381fec9
parent809cde4a640032f2f87319c9358be4fee8d6d7d5 (diff)
downloadglibc-240ceafed7a00af8571d56db67a6b8854e418106.zip
glibc-240ceafed7a00af8571d56db67a6b8854e418106.tar.gz
glibc-240ceafed7a00af8571d56db67a6b8854e418106.tar.bz2
nss_db: Propagate ERANGE error if parse_line fails [BZ #19837]
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)
-rw-r--r--ChangeLog6
-rw-r--r--nss/nss_db/db-XXX.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bb8d618..84d847e 100644
--- 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]
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 70b58be..e13287a 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -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;
}