aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_files
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2014-11-21 03:29:56 -0200
committerAlexandre Oliva <aoliva@redhat.com>2014-11-21 03:29:56 -0200
commit4969890247d7d6a548f17641ed5a18f4b713d211 (patch)
tree26eeb456373435508696552d794f926f02f74701 /nss/nss_files
parent81959214868c9ac9e425fbf0fa3fd9135e207f7e (diff)
downloadglibc-4969890247d7d6a548f17641ed5a18f4b713d211.zip
glibc-4969890247d7d6a548f17641ed5a18f4b713d211.tar.gz
glibc-4969890247d7d6a548f17641ed5a18f4b713d211.tar.bz2
BZ#14498: fix infinite loop in nss_db_getservbyname
nss_db uses nss_files code for services, but a continue on protocol mismatch that doesn't affect nss_files skipped the code that advanced to the next db entry. Any one of these changes would suffice to fix it, but fixing both makes them both safer to reuse elsewhere. for ChangeLog [BZ #14498] * NEWS: Fixed. * nss/nss_db/db-XXX.c (_nss_db_get##name##_r): Update hidx after parsing line but before break_if_match. * nss/nss_files/files-service (DB_LOOKUP): Don't "continue;" if there is a protocol mismatch.
Diffstat (limited to 'nss/nss_files')
-rw-r--r--nss/nss_files/files-service.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
index 2401cb0..c28c62f 100644
--- a/nss/nss_files/files-service.c
+++ b/nss/nss_files/files-service.c
@@ -44,8 +44,11 @@ DB_LOOKUP (servbyname, ':',
{
/* Must match both protocol (if specified) and name. */
if (proto != NULL && strcmp (result->s_proto, proto))
- continue;
- LOOKUP_NAME (s_name, s_aliases)
+ /* A continue statement here breaks nss_db, because it
+ bypasses advancing to the next db entry, and it
+ doesn't make nss_files any more efficient. */;
+ else
+ LOOKUP_NAME (s_name, s_aliases)
},
const char *name, const char *proto)