]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: fix NULL-pointer dereference
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 07:10:05 +0000 (16:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 10:10:19 +0000 (19:10 +0900)
Fixes a bug introduced by 16a6bc5a7a5da2482d96f7dc43da360ceab1c320.
Fixes CID#1501514.

src/resolve/resolved-etc-hosts.c

index 334778706a9a1c639084572be62bbc2d9b1e2937..cf0e2be5fa0b86aff1c7a5829d6e1f3a6227f4aa 100644 (file)
@@ -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) ||