From: ajs Date: Sat, 2 Apr 2005 23:05:56 +0000 (+0000) Subject: 2005-04-02 Andrew J. Schorr X-Git-Tag: frr-2.0-rc1~3112 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=018546e9656b141eeecdf59f627fcdc9b7381840;p=matthieu%2Ffrr.git 2005-04-02 Andrew J. Schorr * 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 35910a6553..f55578e6d7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2005-04-02 Andrew J. Schorr + + * 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 * if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions. diff --git a/lib/if.c b/lib/if.c index 212b236c1e..a32cee0e5b 100644 --- a/lib/if.c +++ b/lib/if.c @@ -768,7 +768,8 @@ if_nametoindex (const char *name) { 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