Source-Changes-HG archive

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

[src/netbsd-1-6]: src/lib/libc/net Pull up revision 1.50 (requested by itojun...



details:   https://anonhg.NetBSD.org/src/rev/5f0f7ef39de3
branches:  netbsd-1-6
changeset: 529016:5f0f7ef39de3
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sat Aug 17 15:55:37 2002 +0000

description:
Pull up revision 1.50 (requested by itojun in ticket #694):
set h_errno properly if internal string manipulation fails.

diffstat:

 lib/libc/net/gethnamaddr.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 781074788629 -r 5f0f7ef39de3 lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c        Sat Aug 17 15:49:53 2002 +0000
+++ b/lib/libc/net/gethnamaddr.c        Sat Aug 17 15:55:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gethnamaddr.c,v 1.42.2.6 2002/08/17 15:45:30 lukem Exp $       */
+/*     $NetBSD: gethnamaddr.c,v 1.42.2.7 2002/08/17 15:55:37 lukem Exp $       */
 
 /*
  * ++Copyright++ 1985, 1988, 1993
@@ -61,7 +61,7 @@
 static char sccsid[] = "@(#)gethostnamadr.c    8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: gethnamaddr.c,v 1.42.2.6 2002/08/17 15:45:30 lukem Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.42.2.7 2002/08/17 15:55:37 lukem Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1198,11 +1198,15 @@
                            ((unsigned int)uaddr[n] >> 4) & 0xf);
                        if (advance > 0 && qp + advance < ep)
                                qp += advance;
-                       else
+                       else {
+                               h_errno = NETDB_INTERNAL;
                                return NS_NOTFOUND;
+                       }
                }
-               if (strlcat(qbuf, "ip6.arpa", sizeof(qbuf)) >= sizeof(qbuf))
+               if (strlcat(qbuf, "ip6.arpa", sizeof(qbuf)) >= sizeof(qbuf)) {
+                       h_errno = NETDB_INTERNAL;
                        return NS_NOTFOUND;
+               }
                break;
        default:
                abort();
@@ -1211,8 +1215,10 @@
        n = res_query(qbuf, C_IN, T_PTR, (u_char *)(void *)&buf, sizeof(buf));
        if (n < 0 && af == AF_INET6) {
                *qp = '\0';
-               if (strlcat(qbuf, "ip6.int", sizeof(qbuf)) >= sizeof(qbuf))
+               if (strlcat(qbuf, "ip6.int", sizeof(qbuf)) >= sizeof(qbuf)) {
+                       h_errno = NETDB_INTERNAL;
                        return NS_NOTFOUND;
+               }
                n = res_query(qbuf, C_IN, T_PTR, (u_char *)(void *)&buf,
                    sizeof(buf));
        }



Home | Main Index | Thread Index | Old Index