<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    When running with -T switch and AnyEvent::Socket tries to connect to
    a host which was resolved from /etc/hosts, it dies with error:<br>
    <div class="moz-forward-container"> <br>
      <blockquote><tt>Insecure dependency in connect while running with
          -T switch at /.../AnyEvent/Socket.pm line 1019.<br>
        </tt></blockquote>
      <br>
      This happens because the parsed $sockaddr remains tainted, so I
      patched Socket.pm making it untaint parsed addresses within
      AnyEvent::Socket::_parse_hosts() :<br>
      <br>
      <pre wrap="">--- a/AnyEvent/Socket.pm
+++ b/AnyEvent/Socket.pm
@@ -662,9 +662,11 @@ sub _parse_hosts($) {
       next unless @aliases;
 
       if (my $ip = parse_ipv4 $addr) {
+         ($ip) = $ip =~ /^(.*)$/s if AnyEvent::TAINT;
          push @{ $HOSTS{$_}[0] }, $ip
             for @aliases;
       } elsif (my $ip = parse_ipv6 $addr) {
+         ($ip) = $ip =~ /^(.*)$/s if AnyEvent::TAINT;
          push @{ $HOSTS{$_}[1] }, $ip
             for @aliases;
       }
</pre>
      <br>
      Regards,<br>
      José<br>
      <br>
      <br>
    </div>
    <br>
  </body>
</html>