Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/faithd fix uninitialized pointer access on mapped a...



details:   https://anonhg.NetBSD.org/src/rev/e3416682c16c
branches:  trunk
changeset: 479735:e3416682c16c
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Dec 20 15:35:55 1999 +0000

description:
fix uninitialized pointer access on mapped addr handling.
add more debugging info on setsockopt errors.

diffstat:

 usr.sbin/faithd/faithd.c |  17 +++++++++--------
 usr.sbin/faithd/ftp.c    |   6 +++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diffs (93 lines):

diff -r 0bf643090b3e -r e3416682c16c usr.sbin/faithd/faithd.c
--- a/usr.sbin/faithd/faithd.c  Mon Dec 20 15:12:23 1999 +0000
+++ b/usr.sbin/faithd/faithd.c  Mon Dec 20 15:35:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: faithd.c,v 1.3 1999/12/20 05:41:35 itojun Exp $        */
+/*     $NetBSD: faithd.c,v 1.4 1999/12/20 15:35:55 itojun Exp $        */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -229,7 +229,7 @@
        if (res->ai_family == AF_INET6) {
                error = setsockopt(s_wld, IPPROTO_IPV6, IPV6_FAITH, &on, sizeof(on));
                if (error == -1)
-                       exit_error("setsockopt: %s", ERRSTR);
+                       exit_error("setsockopt(IPV6_FAITH): %s", ERRSTR);
        }
 #endif
 #ifdef FAITH4
@@ -237,18 +237,18 @@
        if (res->ai_family == AF_INET) {
                error = setsockopt(s_wld, IPPROTO_IP, IP_FAITH, &on, sizeof(on));
                if (error == -1)
-                       exit_error("setsockopt: %s", ERRSTR);
+                       exit_error("setsockopt(IP_FAITH): %s", ERRSTR);
        }
 #endif
 #endif /* FAITH4 */
 
        error = setsockopt(s_wld, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
        if (error == -1)
-               exit_error("setsockopt: %s", ERRSTR);
+               exit_error("setsockopt(SO_REUSEADDR): %s", ERRSTR);
        
        error = setsockopt(s_wld, SOL_SOCKET, SO_OOBINLINE, &on, sizeof(on));
        if (error == -1)
-               exit_error("setsockopt: %s", ERRSTR);
+               exit_error("setsockopt(SO_OOBINLINE): %s", ERRSTR);
 
        error = bind(s_wld, (struct sockaddr *)res->ai_addr, res->ai_addrlen);
        if (error == -1)
@@ -452,14 +452,14 @@
 
        error = setsockopt(s_dst, SOL_SOCKET, SO_OOBINLINE, &on, sizeof(on));
        if (error == -1)
-               exit_error("setsockopt: %s", ERRSTR);
+               exit_error("setsockopt(SO_OOBINLINE): %s", ERRSTR);
 
        error = setsockopt(s_src, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
        if (error == -1)
-               exit_error("setsockopt: %s", ERRSTR);
+               exit_error("setsockopt(SO_SNDTIMEO): %s", ERRSTR);
        error = setsockopt(s_dst, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
        if (error == -1)
-               exit_error("setsockopt: %s", ERRSTR);
+               exit_error("setsockopt(SO_SNDTIMEO): %s", ERRSTR);
 
        error = connect(s_dst, sa4, sa4->sa_family);
        if (error == -1)
@@ -513,6 +513,7 @@
        struct sockaddr_in *dst4;
        struct sockaddr_in dstmap;
 
+       dst6 = (struct sockaddr_in6 *)dst;
        if (dst->sa_family == AF_INET6
         && IN6_IS_ADDR_V4MAPPED(&dst6->sin6_addr)) {
                /* ugly... */
diff -r 0bf643090b3e -r e3416682c16c usr.sbin/faithd/ftp.c
--- a/usr.sbin/faithd/ftp.c     Mon Dec 20 15:12:23 1999 +0000
+++ b/usr.sbin/faithd/ftp.c     Mon Dec 20 15:35:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftp.c,v 1.2 1999/12/09 15:20:02 itojun Exp $   */
+/*     $NetBSD: ftp.c,v 1.3 1999/12/20 15:35:55 itojun Exp $   */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -508,7 +508,7 @@
                error = setsockopt(wport6, IPPROTO_IPV6, IPV6_FAITH,
                        &on, sizeof(on));
                if (error == -1)
-                       exit_error("setsockopt: %s", ERRSTR);
+                       exit_error("setsockopt(IPV6_FAITH): %s", ERRSTR);
            }
 #endif
                error = bind(wport6, (struct sockaddr *)sin6, sin6->sin6_len);
@@ -629,7 +629,7 @@
                error = setsockopt(wport6, IPPROTO_IP, IP_FAITH,
                        &on, sizeof(on));
                if (error == -1)
-                       exit_error("setsockopt: %s", ERRSTR);
+                       exit_error("setsockopt(IP_FAITH): %s", ERRSTR);
            }
 #endif
                error = bind(wport6, (struct sockaddr *)sin, sin->sin_len);



Home | Main Index | Thread Index | Old Index