Closed chaosben closed 1 year ago
The length check here: https://github.com/mikepultz/netdns2/blob/1284c4b1f0a0e1fe087b4fec7dff960d0527e273/Net/DNS2/Socket.php#L363
should be change to
if (strlen($data) < 2) {
in order to raise the correct error.
At the moment a warning/error (depending on php version) is raised here: https://github.com/mikepultz/netdns2/blob/1284c4b1f0a0e1fe087b4fec7dff960d0527e273/Net/DNS2/Socket.php#L369 if the data returned has the length of one byte.
Some servers answer with one byte and because of that the following code in the read-function loops endless.
Code to reproduce:
require 'vendor/autoload.php'; $resolver = new Net_DNS2_Resolver(['nameservers' => ['195.191.93.140']]); //nameserver of backupheld.de $result = $resolver->query('backupheld.de', 'AXFR');
Thanks @chaosben - I haven't been able to reproduce this in any of my testing, but there's no harm in making this change- it will be included in v1.5.4.
Mike
Thank you very much! 🤓
The length check here: https://github.com/mikepultz/netdns2/blob/1284c4b1f0a0e1fe087b4fec7dff960d0527e273/Net/DNS2/Socket.php#L363
should be change to
in order to raise the correct error.
At the moment a warning/error (depending on php version) is raised here: https://github.com/mikepultz/netdns2/blob/1284c4b1f0a0e1fe087b4fec7dff960d0527e273/Net/DNS2/Socket.php#L369 if the data returned has the length of one byte.
Some servers answer with one byte and because of that the following code in the read-function loops endless.
Code to reproduce: