39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
|
From: Ludwig Nussel <ludwig.nussel@suse.de>
|
||
|
Date: Mon, 26 Nov 2012 09:49:42 +0100
|
||
|
Subject: avoid assertion if invalid address familily is passed to
|
||
|
gethostbyaddr_r (bnc#791101)
|
||
|
|
||
|
---
|
||
|
src/nss-myhostname/nss-myhostname.c | 11 ++++++-----
|
||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
|
||
|
index 16ccb3e..884eb99 100644
|
||
|
--- a/src/nss-myhostname/nss-myhostname.c
|
||
|
+++ b/src/nss-myhostname/nss-myhostname.c
|
||
|
@@ -383,6 +383,12 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
|
||
|
struct address *a;
|
||
|
unsigned n_addresses = 0, n;
|
||
|
|
||
|
+ if (af != AF_INET && af != AF_INET6) {
|
||
|
+ *errnop = EAFNOSUPPORT;
|
||
|
+ *h_errnop = NO_DATA;
|
||
|
+ return NSS_STATUS_UNAVAIL;
|
||
|
+ }
|
||
|
+
|
||
|
if (len != PROTO_ADDRESS_SIZE(af)) {
|
||
|
*errnop = EINVAL;
|
||
|
*h_errnop = NO_RECOVERY;
|
||
|
@@ -398,11 +404,6 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
|
||
|
|
||
|
if (memcmp(addr, LOCALADDRESS_IPV6, 16) == 0)
|
||
|
goto found;
|
||
|
-
|
||
|
- } else {
|
||
|
- *errnop = EAFNOSUPPORT;
|
||
|
- *h_errnop = NO_DATA;
|
||
|
- return NSS_STATUS_UNAVAIL;
|
||
|
}
|
||
|
|
||
|
ifconf_acquire_addresses(&addresses, &n_addresses);
|