aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--nss/nss_files/files-netgrp.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a1f549e655..322ec08cc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-01-27 Siddhesh Poyarekar <siddhesh@redhat.com>
+ [BZ #16506]
+ * nss/nss_files/files-netgrp.c (_nss_files_setnetgrent): Avoid
+ access beyond array bounds when parsing netgroups file.
+
* nscd/netgroupcache.c (addgetnetgrentX): Compute offset from
the old buffer before realloc.
diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
index 339f704c93..34eae4c5be 100644
--- a/nss/nss_files/files-netgrp.c
+++ b/nss/nss_files/files-netgrp.c
@@ -103,7 +103,8 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result)
result->cursor += (curlen - group_len) - 1;
}
- while (line[curlen - 1] == '\n' && line[curlen - 2] == '\\')
+ while (curlen > 1 && line[curlen - 1] == '\n'
+ && line[curlen - 2] == '\\')
{
/* Yes, we have a continuation line. */
if (found)