Fix adopt function the same way as in upstream

Related: RHEL-35381
This commit is contained in:
Tomas Halman 2024-05-20 10:21:00 +02:00
parent 42f7bcc4fe
commit ef3639050f
2 changed files with 9 additions and 18 deletions

View File

@ -33,29 +33,16 @@ diff -up xmlsec1-1.2.29/src/c14n.c.orig xmlsec1-1.2.29/src/c14n.c
diff -up xmlsec1-1.2.29/src/gcrypt/asymkeys.c.orig xmlsec1-1.2.29/src/gcrypt/asymkeys.c diff -up xmlsec1-1.2.29/src/gcrypt/asymkeys.c.orig xmlsec1-1.2.29/src/gcrypt/asymkeys.c
--- xmlsec1-1.2.29/src/gcrypt/asymkeys.c.orig 2024-05-10 18:47:45.800368678 +0200 --- xmlsec1-1.2.29/src/gcrypt/asymkeys.c.orig 2024-05-10 18:47:45.800368678 +0200
+++ xmlsec1-1.2.29/src/gcrypt/asymkeys.c 2024-05-13 09:11:08.784351577 +0200 +++ xmlsec1-1.2.29/src/gcrypt/asymkeys.c 2024-05-13 09:11:08.784351577 +0200
@@ -198,6 +198,9 @@ done: @@ -186,6 +186,9 @@ xmlSecGCryptAsymKeyDataAdoptKey(xmlSecKe
gcry_sexp_release(priv_key); pub_key = NULL; /* data owns it now */
} priv_key = NULL; /* data owns it now */
+ /* Adopt functions assume ownership thus the caller would expect this to be released */ + /* Adopt functions assume ownership thus the caller would expect this to be released */
+ gcry_sexp_release(key_pair); + gcry_sexp_release(key_pair);
+ +
/* done */
return(res);
}
@@ -292,11 +295,11 @@ xmlSecGCryptAsymKeyDataGenerate(xmlSecKe
}
ret = xmlSecGCryptAsymKeyDataAdoptKey(data, key_pair);
+ key_pair = NULL; /* now owned by data */
if(ret < 0) {
xmlSecInternalError("xmlSecGCryptAsymKeyDataAdopt", NULL);
goto done;
}
- key_pair = NULL; /* now owned by data */
/* success */ /* success */
res = 0; res = 0;
diff -up xmlsec1-1.2.29/src/parser.c.orig xmlsec1-1.2.29/src/parser.c diff -up xmlsec1-1.2.29/src/parser.c.orig xmlsec1-1.2.29/src/parser.c
--- xmlsec1-1.2.29/src/parser.c.orig 2024-05-10 13:46:59.217160842 +0200 --- xmlsec1-1.2.29/src/parser.c.orig 2024-05-10 13:46:59.217160842 +0200
+++ xmlsec1-1.2.29/src/parser.c 2024-05-10 17:28:22.848994008 +0200 +++ xmlsec1-1.2.29/src/parser.c 2024-05-10 17:28:22.848994008 +0200

View File

@ -1,7 +1,7 @@
Summary: Library providing support for "XML Signature" and "XML Encryption" standards Summary: Library providing support for "XML Signature" and "XML Encryption" standards
Name: xmlsec1 Name: xmlsec1
Version: 1.2.29 Version: 1.2.29
Release: 12%{?dist}%{?extra_release} Release: 13%{?dist}%{?extra_release}
License: MIT License: MIT
Source0: https://www.aleksey.com/xmlsec/download/xmlsec1-%{version}.tar.gz Source0: https://www.aleksey.com/xmlsec/download/xmlsec1-%{version}.tar.gz
URL: http://www.aleksey.com/xmlsec/ URL: http://www.aleksey.com/xmlsec/
@ -178,6 +178,10 @@ mv %{buildroot}%{_docdir}/xmlsec1/* __tmp_doc
%{_libdir}/pkgconfig/xmlsec1-nss.pc %{_libdir}/pkgconfig/xmlsec1-nss.pc
%changelog %changelog
* Mon May 20 2024 Tomas Halman <thalman@redhat.com> - 1.2.29-12
- Fix adopt function the same way as in upstream
Related: RHEL-35381
* Fri May 17 2024 Tomas Halman <thalman@redhat.com> - 1.2.29-12 * Fri May 17 2024 Tomas Halman <thalman@redhat.com> - 1.2.29-12
- Fix double free in xmlSecGCryptAsymKeyDataGenerate - Fix double free in xmlSecGCryptAsymKeyDataGenerate
Related: RHEL-35381 Related: RHEL-35381