summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-etc-hosts.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-12-14 16:10:05 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-14 19:10:19 +0900
commit863b620a4aba29de73b34d9db2b10fd30c198855 (patch)
tree682204963015c1b467acaf3e9de88803de1dd243 /src/resolve/resolved-etc-hosts.c
parentb1c4466bbab06e5ac48cd801907780919cf45285 (diff)
downloadsystemd-863b620a4aba29de73b34d9db2b10fd30c198855.tar.gz
resolve: fix NULL-pointer dereference
Fixes a bug introduced by 16a6bc5a7a5da2482d96f7dc43da360ceab1c320. Fixes CID#1501514.
Diffstat (limited to 'src/resolve/resolved-etc-hosts.c')
-rw-r--r--src/resolve/resolved-etc-hosts.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c
index 334778706a..cf0e2be5fa 100644
--- a/src/resolve/resolved-etc-hosts.c
+++ b/src/resolve/resolved-etc-hosts.c
@@ -486,7 +486,7 @@ static int etc_hosts_lookup_by_name(
break;
}
- SET_FOREACH(a, item->addresses) {
+ SET_FOREACH(a, item ? item->addresses : NULL) {
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
if ((!found_a && a->family == AF_INET) ||