[fpc-pascal] CRITICAL Bug in Lnet DNSLookup failure problem

Dennis Poon dennis at avidsoft.com.hk
Thu Nov 28 08:44:19 CET 2013

when using lnet to connect to a remote server at DomainName : Port e.g. 
yahoo.com   : 80
in file lCommon.pp line 492:
function StrToNetAddr(const IP : String) : Sockets.in_addr;inline;
   result := Sockets.StrToNetAddr(IP);

The above function did not raise exception when the IP parameter is a 
null string, which is the return value of a failed DNSlookup of a domain 
The consequence is grave!
When the DNS lookup fails, it returns a null IP string which the 
StrToNetAddr converts to the IPv4.sin_Addr structure without 
raising any exception.  If the local computer happens to have a port 
listening at port 80, it just connects to the port 80 of the local 
machine whenever the DNS lookup of the target domain fails!!!

 From past experience, the lnet author non longer responds to the any 
bug report, I am only mentioning this bug here so that other lnet users 
won't have to find out this bug the hard way (3 days of looking for bug 
in the wrong places) like I did.

The fix is simple, so I will modify the code myself but just hope every 
new users of lnet can apply this fix before they use lnet.


More information about the fpc-pascal mailing list