2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* if.c: (if_nametoindex) The man page is rather vague, but it seems
	  like the argument to if_nametoindex has an implicit maximum length
	  of IFNAMSIZ characters.
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 35910a6..f55578e 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,11 @@
 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
+	* if.c: (if_nametoindex) The man page is rather vague, but it seems
+	  like the argument to if_nametoindex has an implicit maximum length
+	  of IFNAMSIZ characters.
+
+2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
 	* if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions.
 	* if.c: (if_lookup_by_name_len, if_get_by_name_len) New functions.
 	  (if_get_by_name) Tighten up code.
diff --git a/lib/if.c b/lib/if.c
index 212b236..a32cee0 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -768,7 +768,8 @@
 {
   struct interface *ifp;
 
-  return ((ifp = if_lookup_by_name(name)) != NULL) ? ifp->ifindex : 0;
+  return ((ifp = if_lookup_by_name_len(name, strnlen(name, IFNAMSIZ))) != NULL)
+  	 ? ifp->ifindex : 0;
 }
 #endif