From d090e485447145f0642601561fd70f32cf24ce8d Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 23 Jan 2023 08:58:42 +0100 Subject: [PATCH] validate result of Net_DNS2_Resolver::query (CNAME's are being resolved to their corresponding target A/AAAA addresses); fixes #1089 Signed-off-by: Michael Kaufmann --- lib/Froxlor/PhpHelper.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php index 820f14a7..c81f50bd 100644 --- a/lib/Froxlor/PhpHelper.php +++ b/lib/Froxlor/PhpHelper.php @@ -263,7 +263,9 @@ class PhpHelper try { $answer = $resolver->query($host, 'A')->answer; foreach ($answer as $rr) { - $ips[] = inet_ntop(inet_pton($rr->address)); + if ($rr instanceof Net_DNS2_RR_A) { + $ips[] = inet_ntop(inet_pton($rr->address)); + } } } catch (Net_DNS2_Exception $e) { // we can't do anything here, just continue @@ -274,7 +276,9 @@ class PhpHelper try { $answer = $resolver->query($host, 'AAAA')->answer; foreach ($answer as $rr) { - $ips[] = inet_ntop(inet_pton($rr->address)); + if ($rr instanceof Net_DNS2_RR_AAAA) { + $ips[] = inet_ntop(inet_pton($rr->address)); + } } } catch (Net_DNS2_Exception $e) { // we can't do anything here, just continue