Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net properly check the error result from if_nametoi...



details:   https://anonhg.NetBSD.org/src/rev/432073c62ab3
branches:  trunk
changeset: 479923:432073c62ab3
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Dec 27 10:20:59 1999 +0000

description:
properly check the error result from if_nametoindex(), to disallow
bogus interface index specification like fe80::1@bogus.
(sync with kame)

diffstat:

 lib/libc/net/getaddrinfo.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 978fcf0e6044 -r 432073c62ab3 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Mon Dec 27 06:38:47 1999 +0000
+++ b/lib/libc/net/getaddrinfo.c        Mon Dec 27 10:20:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getaddrinfo.c,v 1.16 1999/12/13 17:05:45 itojun Exp $  */
+/*     $NetBSD: getaddrinfo.c,v 1.17 1999/12/27 10:20:59 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -868,6 +868,10 @@
 #ifdef INET6
        case AF_INET6:
                scope = if_nametoindex(cp);
+               if (scope == 0) {
+                       free(hostname2);
+                       return (EAI_NONAME);
+               }
                break;
 #endif
        }



Home | Main Index | Thread Index | Old Index