systemd/avoid-assertion-if-invalid-address-familily-is-passed-to-g.patch
Stephan Kulow a699b1ca34 Accepting request 172873 from Base:System
- Do not provide %{release} for systemd-analyze
- Add more conflicts to -mini packages
- Disable Predictable Network interface names until it has been
  reviewed by network team, with /usr/lib/tmpfiles.d/network.conf.
- Don't package /usr/lib/firmware/update (not used) (forwarded request 172848 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/172873
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=135
2013-04-23 09:39:56 +00:00

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);