[xmlsec] Memory Leak when using xmlSecTmplX509DataAddSubjectName

Aleksey Sanin aleksey at aleksey.com
Mon Jun 3 08:32:38 PDT 2013


Good. And one more

https://git.gnome.org/browse/xmlsec/commit/?id=1a53ec712152ea33e16b524833f4a9db48be43b8

Could you please try it?

Aleksey

On 6/3/13 8:25 AM, Alexwell Sandro wrote:
> I replace the x509.c file.
> 
> Fixed memory leak when signing.
> 
> But not when verify. I'll check the code.
> 
> 
> On Mon, Jun 3, 2013 at 12:08 PM, Aleksey Sanin <aleksey at aleksey.com
> <mailto:aleksey at aleksey.com>> wrote:
> 
>     Yeah, you need to first build the ate all. Can you just apply the
>     diff on top of the 1.2.9?
> 
> 
>     -- Aleksey
> 
> 
>     On Jun 3, 2013, at 7:53 AM, Alexwell Sandro <alexwellll at gmail.com
>     <mailto:alexwellll at gmail.com>> wrote:
> 
>>     I compiled the version xmlsec1-1.2.19 with "no problem".
>>
>>     But this <fix memory leak in converting cert subject
>>     <https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25>>,
>>     I can not compile.
>>
>>     *Result:*
>>     base64.c
>>     ..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open
>>     include file: 'xmlsec/version.h': No such file or directory bn.c
>>     ..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open
>>     include file: 'xmlsec/version.h': No such file or directory buffer.c
>>     ...
>>
>>
>>
>>     On Mon, Jun 3, 2013 at 11:40 AM, Alexwell Sandro
>>     <alexwellll at gmail.com <mailto:alexwellll at gmail.com>> wrote:
>>
>>         Of course, thanks!
>>
>>
>>
>>
>>         On Mon, Jun 3, 2013 at 11:33 AM, Aleksey Sanin
>>         <aleksey at aleksey.com <mailto:aleksey at aleksey.com>> wrote:
>>
>>             Good catch. I think I found it
>>
>>             https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25
>>
>>             Can you try it? I don't have windows env these days.
>>
>>             Aleksey
>>
>>             On 6/3/13 7:00 AM, Alexwell Sandro wrote:
>>             > I found memory leak with
>>             xmlSecTmplX509DataAddSubjectName function.
>>             >
>>             > I used example from: Signing a dynamicaly created
>>             template. sign2.c.
>>             >
>>              <http://www.aleksey.com/xmlsec/api/xmlsec-examples-sign-dynamimc-template.html>
>>             >
>>             > *To generate template:*
>>             > (...)
>>             > xmlNodePtr keyInfoNode =
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
>>             > xmlNodePtr x509DataNode =
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
>>             > xmlSecTmplX509DataAddSubjectName(x509DataNode);
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);
>>             > (...)
>>             >
>>             > *Result:*
>>             > (...)
>>             > <ds:KeyInfo>
>>             > <ds:X509Data>
>>             > <ds:X509SubjectName/>
>>             > <ds:X509Certificate/>
>>             > </ds:X509Data>
>>             > </ds:KeyInfo>
>>             > (...)
>>             >
>>             > *When sign the template occurs memory leak.*
>>             >
>>             > Data:
>>             >     43 00 4E 00    3D 00 41 00    4C 00 45 00    58 00 20 00
>>             > C.N.=.A. L.E.X...
>>             > ...
>>             >
>>             > *When I remove "xmlSecTmplX509DataAddSubjectName"*
>>             > xmlNodePtr keyInfoNode =
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
>>             > xmlNodePtr x509DataNode =
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
>>             > /// xmlSecTmplX509DataAddSubjectName(x509DataNode);/
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);
>>             >
>>             > No memory leak detected!
>>             >
>>             > *The same problem when verify the signature.*
>>             > With <ds:X509SubjectName> Two Memory Leaks.
>>             >
>>             >  Data:
>>             >     43 4E 3D 41    4C 45 58 20    53 41
>>             <tel:45%2058%2020%20%C2%A0%20%C2%A053%2041> 4E 44    52 4F
>>             20 44     CN=ALEX. S
>>             > ...
>>             >
>>             >  Data:
>>             >     43 4E 3D 41    4C 45 58 20    53 41
>>             <tel:45%2058%2020%20%C2%A0%20%C2%A053%2041> 4E 44    52 4F
>>             20 44     CN=ALEX. S
>>             > ...
>>             >
>>             > *Without  <ds:X509SubjectName> No Memory Leak.*
>>             >
>>             > *Another detail, when I use:*
>>             > xmlNodePtr keyInfoNode =
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
>>             > xmlNodePtr x509DataNode =
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
>>             >
>>             > *result:*
>>             > <KeyInfo>
>>             > <X509Data>
>>             > <X509Certificate>MIIE3zCCA8e...
>>             >
>>             > *When I use:*
>>             > xmlNodePtr keyInfoNode =
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
>>             > xmlNodePtr x509DataNode =
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);
>>             >
>>             > *result with breakline:*
>>             > <KeyInfo>
>>             > <X509Data>
>>             >
>>             > <X509Certificate>MIIE3zCCA8e...
>>             >
>>             > *When I use:*
>>             > xmlNodePtr x509DataNode =
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
>>             > xmlSecTmplX509DataAddSubjectName(x509DataNode);
>>             >
>>             > *result with breakline:*
>>             > <X509Data>
>>             >
>>             > <X509SubjectName>CN=ALEX...
>>             >
>>             > *How to fix the memory leak?*
>>             >
>>             > tags: windows 7 64 bits, visual studio 2010.
>>
>>
>>
>>     _______________________________________________
>>     xmlsec mailing list
>>     xmlsec at aleksey.com <mailto:xmlsec at aleksey.com>
>>     http://www.aleksey.com/mailman/listinfo/xmlsec
> 
> 
> 
> 
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
> 


More information about the xmlsec mailing list