php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81400 Unterminated string in dns_get_record() results on Windows
Submitted: 2021-08-30 14:08 UTC Modified: 2021-08-30 14:08 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: Network related
PHP Version: 7.4Git-2021-08-30 (Git) OS: Windows
Private report: No CVE-ID: None
 [2021-08-30 14:08 UTC] 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


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-30 14:08 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2021-08-30 14:19 UTC] cmb@php.net
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
 [2021-08-30 16:56 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/edab9ad205201b746ade169256519110e240381d
Log: Fix #81400: Unterminated string in dns_get_record() results
 [2021-08-30 16:56 UTC] git@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC