Bug #81400 [PATCH]: Unterminated string in dns_get_record() results on Windows

From: Date: Mon, 30 Aug 2021 14:19:20 +0000
Subject: Bug #81400 [PATCH]: Unterminated string in dns_get_record() results on Windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236178@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81400&edit=1 ID: 81400 Patch added by: cmb@php.net Reported by: cmb@php.net Summary: Unterminated string in dns_get_record() results on Windows Status: Assigned Type: Bug Package: Network related Operating System: Windows PHP Version: 7.4Git-2021-08-30 (Git) Assigned To: cmb Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix #81400: Unterminated string in dns_get_record() results On GitHub: https://github.com/php/php-src/pull/7427 Patch: https://github.com/php/php-src/pull/7427.patch Previous Comments: ------------------------------------------------------------------------ [2021-08-30 14:08:45] cmb@php.net Description: ------------ On Windows, dns_get_record(…)[$i]["txt"] is always unterminated (if that element exists). This can lead to serious issues if that string is passed to some other functions. Test script: --------------- $result = dns_get_record("php.net", DNS_TXT); print_r($result[0]); Expected result: ---------------- Array ( [host] => php.net [class] => IN [ttl] => 300 [type] => TXT [txt] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ip4:208.43.231.12 ip4:45.112.84.5 ip4:142.93.197.176 ip6:2604:a880:400:d0::1c74:1001 ip6:2a02:cb43:8000::1102 ?all [entries] => Array ( [0] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ip4:208.43.231.12 ip4:45.112.84.5 ip4:142.93.197.176 ip6:2604:a880:400:d0::1c74:1001 ip6:2a02:cb43:8000::1102 ?all ) ) Actual result: -------------- Array ( [host] => php.net [class] => IN [ttl] => 300 [type] => TXT [txt] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ip4:208.43.231.12 ip4:45.112.84.5 ip4:142.93.197.176 ip6:2604:a880:400:d0::1c74:1001 ip6:2a02:cb43:8000::1102 ?all [entries] => Array ( [0] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ip4:208.43.231.12 ip4:45.112.84.5 ip4:142.93.197.176 ip6:2604:a880:400:d0::1c74:1001 ip6:2a02:cb43:8000::1102 ?all ) ) Warning: String is not zero-terminated (v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ip4:208.43.231.12 ip4:45.112.84.5 ip4:142.93.197.176 ip6:2604:a880:400:d0::1c74:1001 ip6:2a02:cb43:8000::1102 ?all) in Unknown on line 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81400&edit=1

« previous php.bugs (#236178) next »