From ff183e701599e6ca44f5fa78b60948f87a08a133 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Jan 2014 16:48:09 +0100 Subject: Don't use atoi for interface indexes --- src/socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/socket.c') diff --git a/src/socket.c b/src/socket.c index a9e6f33..744945e 100644 --- a/src/socket.c +++ b/src/socket.c @@ -108,9 +108,10 @@ static int bind_socket(fastd_context_t *ctx, const fastd_bind_address_t *addr, b fastd_peer_address_t bind_address = addr->addr; if (fastd_peer_address_is_v6_ll(&addr->addr) && addr->bindtodev) { - bind_address.in6.sin6_scope_id = atoi(addr->bindtodev); + char *end; + bind_address.in6.sin6_scope_id = strtoul(addr->bindtodev, &end, 10); - if (!bind_address.in6.sin6_scope_id) + if (*end) bind_address.in6.sin6_scope_id = if_nametoindex(addr->bindtodev); if (!bind_address.in6.sin6_scope_id) { -- cgit v1.2.3