backport to avoid calling functions without prototype,add -Wno-error

(cherry picked from commit 75204ca35d301d97e7fe48127865310f6e671b1e)
This commit is contained in:
yuncang123 2024-09-04 18:05:57 +08:00 committed by openeuler-sync-bot
parent 3af7f11d68
commit b15fd1b6b6
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From 17c6c80de8edd5d08db5bc2f914af6473a6f0f46 Mon Sep 17 00:00:00 2001
From: yuncang123 <1050706328@qq.com>
Date: Sun, 1 Sep 2024 16:08:07 +0800
Subject: [PATCH] backport-pgp-avoid calling functions without prototype
---
src/libopensc/card-openpgp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
index fad32f0..e4e6cc4 100644
--- a/src/libopensc/card-openpgp.c
+++ b/src/libopensc/card-openpgp.c
@@ -129,7 +129,7 @@ static pgp_ec_curves_t ec_curves_gnuk[] = {
static int pgp_get_card_features(sc_card_t *card);
static int pgp_finish(sc_card_t *card);
-static void pgp_iterate_blobs(pgp_blob_t *, void (*func)());
+static void pgp_free_blobs(pgp_blob_t *);
static int pgp_get_blob(sc_card_t *card, pgp_blob_t *blob,
unsigned int id, pgp_blob_t **ret);
@@ -947,7 +947,7 @@ pgp_finish(sc_card_t *card)
if (priv != NULL) {
/* delete fake file hierarchy */
- pgp_iterate_blobs(priv->mf, pgp_free_blob);
+ pgp_free_blobs(priv->mf);
/* delete private data */
free(priv);
@@ -1147,10 +1147,10 @@ pgp_free_blob(pgp_blob_t *blob)
/**
- * Internal: iterate through the blob tree, calling a function for each blob.
+ * Internal: iterate through the blob tree, calling pgp_free_blob for each blob.
*/
static void
-pgp_iterate_blobs(pgp_blob_t *blob, void (*func)())
+pgp_free_blobs(pgp_blob_t *blob)
{
if (blob) {
pgp_blob_t *child = blob->files;
@@ -1158,10 +1158,10 @@ pgp_iterate_blobs(pgp_blob_t *blob, void (*func)())
while (child != NULL) {
pgp_blob_t *next = child->next;
- pgp_iterate_blobs(child, func);
+ pgp_free_blobs(child);
child = next;
}
- func(blob);
+ pgp_free_blob(blob);
}
}
--
2.43.0

View File

@ -3,7 +3,7 @@
Name: opensc
Version: 0.23.0
Release: 5
Release: 6
License: LGPL-2.1-or-later
Summary: Smart card library and applications
URL: https://github.com/OpenSC/OpenSC/wiki
@ -33,6 +33,7 @@ Patch17: 0018-opensc-CVE-2023-40661-12of12.patch
# https://github.com/OpenSC/OpenSC/pull/2948
# https://github.com/OpenSC/OpenSC/pull/3016
Patch18: 0019-opensc-CVE-2023-5992.patch
Patch19: 0020-backport-avoid-calling-functions-without-prototype.patch
BuildRequires: openssl-devel pcsc-lite-devel bash-completion docbook-style-xsl readline-devel
BuildRequires: desktop-file-utils /usr/bin/xsltproc autoconf automake libtool gcc
@ -64,6 +65,9 @@ cp -p src/pkcs15init/README ./README.pkcs15init
cp -p src/scconf/README.scconf .
%build
%if "%toolchain" == "clang"
CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument -Wno-error=unused-but-set-variable"
%endif
autoreconf -fvi
sed -i -e 's/opensc.conf/opensc-%{_arch}.conf/g' src/libopensc/Makefile.in
sed -i -e 's|"/lib /usr/lib\b|"/%{_lib} %{_libdir}|' configure # lib64 rpaths
@ -163,6 +167,9 @@ make check
%{_datadir}/opensc/
%changelog
* Sun Sep 1 2024 yuanchao <1050706328@qq.com> - 0.23.0-6
- backport:avoid calling functions without prototype,and add compiler flags to support clang build
* Fri Jun 28 2024 dillon chen <dillon.chen@gmail.com> - 0.23.0-5
- fix CVE-2023-5992