Search the Community
Showing results for tags 'overbyteicswsocket.pas'.
Found 2 results
In OverbyteIcsWSocket.pas, PunyServerName is always filled with 8-bit data, even if it is a 16-bit UnicodeString on Unicode Delphis. This happens in OverbyteIcsWSocket.pas line 15916 (SVN 1469): Move(DataExt, Ws.FCliHelloData.PunyServerName, Slen); The line above works well with non Unicode Delphis, but copies incorrect data in Unicode enabled Delphis. Cause is the declaration of PunyServerName (line 3488): TClientHelloData = record ServerName: String; PunyServerName: String; // <-- Problem here. ... Later on, this results in incorrect conversion to ServerName. See that the OverbyteIcsSslWebServ demo outputs garbled SNI and Server Name instead of localhost: HTTPS Server is waiting for connections https://localhost/demo.html HTTP Server is waiting for connections http://localhost/demo.html [10:17:36 127.0.0.1] SNI "潬慣桬獯t Client Hello: Server Name: 潬慣桬獯t [10:18:15 127.0.0.1] SNI "潬慣桬獯t Client Hello: Server Name: 潬慣桬獯t A quick remedy is to declare PunyServerName as AnsiString and work around the warning "OverbyteIcsWSocket.pas(15968): W1057 Implicit string cast from 'AnsiString' to 'string'", possibly be adding a typecast. TClientHelloData = record ServerName: String; PunyServerName: AnsiString; // <-- 8-bit string, even in Unicode Delphis. ... Ralf
OverbyteIcsWSocket.pas has at least one small memory leak. In line 17009 (SVN 1464), an X509Obj is duplicated before its is added to the list. However, TX509Base.Create() duplicates the duplication once more before TX509List.Add() stores it to the list. The first duplicated object is never freed, resulting in the leak. This is the line in question: CertList.Add(f_X509_dup(f_X509_OBJECT_get0_X509 (MyX509Obj))); The fix is to remove f_X509_dup(), so the line looks like this: CertList.Add(f_X509_OBJECT_get0_X509 (MyX509Obj)); Code analysis suggests that a similar leak is present in line 15012, but I have not been able to trigger this code running one of the Sample projects: Cert.AddToInters(f_X509_dup(f_X509_OBJECT_get0_X509 (MyX509Obj))); Ralf