Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net set h_errno properly if internal string manipul...
details: https://anonhg.NetBSD.org/src/rev/4320df43f20f
branches: trunk
changeset: 535382:4320df43f20f
user: itojun <itojun%NetBSD.org@localhost>
date: Fri Aug 16 21:54:00 2002 +0000
description:
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 bc44e37846f0 -r 4320df43f20f lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Fri Aug 16 21:43:14 2002 +0000
+++ b/lib/libc/net/gethnamaddr.c Fri Aug 16 21:54:00 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.49 2002/08/16 11:30:28 itojun Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.50 2002/08/16 21:54:00 itojun 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.49 2002/08/16 11:30:28 itojun Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.50 2002/08/16 21:54:00 itojun Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1193,11 +1193,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();
@@ -1206,8 +1210,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