[xmlsec] Memory Leak when using xmlSecTmplX509DataAddSubjectName

Alexwell Sandro alexwellll at gmail.com
Mon Jun 3 07:53:45 PDT 2013


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>wrote:

> Of course, thanks!
>
>
>
>
> On Mon, Jun 3, 2013 at 11:33 AM, Aleksey Sanin <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 4E 44    52 4F 20 44
>> CN=ALEX. S
>> > ...
>> >
>> >  Data:
>> >     43 4E 3D 41    4C 45 58 20    53 41 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.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aleksey.com/pipermail/xmlsec/attachments/20130603/ca1a78ac/attachment.html>


More information about the xmlsec mailing list