Hi,

This server responding but incorrectly ! 
After connect they return just array of zeroes #0 without any data.

This cause infinite loop in TCustomWSocket.AsyncReceive !

Timeout will not works - events not comes because of 100% cpu
usage in infinite loop.

Exactly this server nmact1.nmact.org hangs MailSnd demo immediately
after Connect so you can only kill the process.

I fixed it by adding this lines to TCustomSmtpClient.WSocketDataAvailable:

if(FState=smtpWaitingBanner) and (Len>0) and
(FReceiveBuffer[0]=AnsiChar(#0))  then
       begin
       FLastResponse:='unexpected server reply';
       SetErrorMessage;
       FRequestResult := 500;
       TriggerRequestDone(500);
       Exit;
       end;

This will works only for Smtp protocol. But I think it's should be fixed
on TWSocket level to fix possible problems with all remaining protocols.

---
With best regards, Max Terentiev.
Business Software Products.
AMS Development Team.
supp...@bspdev.com

> -----Original Message-----
> From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of
> Angus Robertson - Magenta Systems Ltd
> Sent: Wednesday, September 30, 2015 9:56 AM
> To: twsocket@lists.elists.org
> Subject: Re: [twsocket] Serious bug in SmtpCli/TWSocket: infinite loop
> 
> > Just found serious problem of TWSocket/TSmtpCli:
> > infinite loop around DoRecv/DataAvailable in TWSocket !
> > It's happens only with some misconfigured/buggy MX servers.
> > Yes, nmact1.nmact.org is misconfigured (i check it using sniffer -
> > they return 4096 bytes of zeroes (\0) as reply) but ICS should handle
> > all situations anyway.
> 
> If the remote SMTP server does not respond to commands, nothing will
> work.  I'll make sure there is a timeout or something.
> 
> Angus
> 
> --
> To unsubscribe or change your settings for TWSocket mailing list please
> goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to