summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/if_index.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:03:01 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:03:01 +0000
commit14970231a38310b9561052a67b617138eeaad300 (patch)
tree35c201a651afa5d5e4fff241280081b3f88b9c2c /sysdeps/mach/hurd/if_index.c
parentf08c7420b5e8b017a1a47b880a62b15bdc588f4d (diff)
parent25ead03a3712d57df2208fe82f3d316eb8faeaf6 (diff)
Merge commit 'refs/top-bases/t/extern_inline' into t/extern_inline
Diffstat (limited to 'sysdeps/mach/hurd/if_index.c')
-rw-r--r--sysdeps/mach/hurd/if_index.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c
index 6479458a56..4303c938a8 100644
--- a/sysdeps/mach/hurd/if_index.c
+++ b/sysdeps/mach/hurd/if_index.c
@@ -1,5 +1,5 @@
/* Find network interface names and index numbers. Hurd version.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,12 @@ __if_nametoindex (const char *ifname)
if (fd < 0)
return 0;
+ if (strlen (ifname) >= IFNAMSIZ)
+ {
+ __set_errno (ENODEV);
+ return 0;
+ }
+
strncpy (ifr.ifr_name, ifname, IFNAMSIZ);
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
{
@@ -187,7 +193,6 @@ libc_hidden_weak (if_indextoname)
#if 0
void
-internal_function
__protocol_available (int *have_inet, int *have_inet6)
{
*have_inet = _hurd_socket_server (PF_INET, 0) != MACH_PORT_NULL;