summary refs log tree commit diff
path: root/nis/nss_nis/nis-network.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis/nis-network.c')
-rw-r--r--nis/nss_nis/nis-network.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index f28fbdaa4f..f1b72bcd75 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -179,6 +179,13 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
 
   /* Convert name to lowercase.  */
   size_t namlen = strlen (name);
+  /* Limit name length to the maximum size of an RPC packet.  */
+  if (namlen > UDPMSGSIZE)
+    {
+      *errnop = ERANGE;
+      return NSS_STATUS_UNAVAIL;
+    }
+
   char name2[namlen + 1];
   size_t i;