about summary refs log tree commit diff
path: root/nss/nsswitch.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 69b1be5e08..099f405c6e 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -189,8 +189,16 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
   size_t cnt;
 
   for (cnt = 0; cnt < sizeof databases; ++cnt)
-    if (strcmp (dbname, databases[cnt].name) == 0)
-      break;
+    {
+      int cmp = strcmp (dbname, databases[cnt].name);
+      if (cmp == 0)
+	break;
+      if (cmp > 0)
+	{
+	  errno = EINVAL;
+	  return -1;
+	}
+    }
 
   if (cnt == sizeof databases)
     {