When using mail-client from ICS, and set the subject property with a string
length very long, my exe crashes and goes down and I found the reason here:
procedure TCustomSmtpClient.DataNext;
    MsgLine  : array [0..1023] of char;
    { If we have been disconnected, then do nothing.                      }
    { RequestDone event handler is called from socket SessionClose event. }
    if not FConnected then begin
        FWSocket.OnDataSent := nil;
    if FItemCount < FHdrLines.Count then begin
        { There are still header lines to send }
-->        StrPCopy(@MsgLine, FHdrLines.Strings[FItemCount]);  <-- here
There is no check for length of the line in FHdrLines before copying the
line. If the line length is longer than 1024, the copying will fail and
crash the exe.
I'm not sure how to fix this the best way. The easiest I guess is to use
StrPLCopy and ensure not copying more than we have room for. But is it
nessecary to copy the content before putting in the send-buffer? Would it
not be more effecient and easy to just put the underlying text in the
stringlist from the right index directly in the send-buffer? In C++ I would
do something like this:
Regards Bjørnar
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to