diff --git a/backport-Add-check-after-malloc-allocation.patch b/backport-Add-check-after-malloc-allocation.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5b4cb2bbc074fd6d2f93d2600a996cdc824d808 --- /dev/null +++ b/backport-Add-check-after-malloc-allocation.patch @@ -0,0 +1,31 @@ +From 466bd9dd8b8836af34f29976a5b0b83950bbe8ed Mon Sep 17 00:00:00 2001 +From: Li kunyu +Date: Mon, 19 Dec 2022 15:20:42 +0800 +Subject: [PATCH] example_plugin: Add check after malloc allocation + +Reference:https://github.com/rpm-software-management/libdnf/commit/466bd9dd8b8836af34f29976a5b0b83950bbe8ed +Conflict:NA + +--- + plugins/example_plugin.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/plugins/example_plugin.c b/plugins/example_plugin.c +index 3f1b119f31..a12439bffd 100644 +--- a/plugins/example_plugin.c ++++ b/plugins/example_plugin.c +@@ -78,9 +78,11 @@ PluginHandle * pluginInitHandle(int version, PluginMode mode, DnfPluginInitData + break; + } + handle = malloc(sizeof(*handle)); +- handle->mode = mode; +- handle->context = pluginGetContext(initData); +- handle->outStream = outStream; ++ if (handle) { ++ handle->mode = mode; ++ handle->context = pluginGetContext(initData); ++ handle->outStream = outStream; ++ } + } while (0); + + fprintf(outStream, "%s: %s: exit =========================\n", info.name, __func__); diff --git a/libdnf.spec b/libdnf.spec index d0aa8d6586bdbafbe0e08bac583dbaf0e6c55811..121b52fac77f56c6e6cbe0b7093cf8302bb07468 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -18,7 +18,7 @@ Name: libdnf Version: 0.69.0 -Release: 3 +Release: 4 Summary: Library providing simplified C and Python API to libsolv License: LGPLv2+ URL: https://github.com/rpm-software-management/libdnf @@ -44,6 +44,7 @@ Patch6000: backport-query-py-ensure-reldep-is-from-the-same-sack %ifarch loongarch64 Patch6001: 0001-libdnf-0.65.0-add-loongarch-support.patch %endif +Patch6002: backport-Add-check-after-malloc-allocation.patch %description A Library providing simplified C and Python API to libsolv. @@ -123,6 +124,9 @@ popd %{python3_sitearch}/hawkey/ %changelog +* Fri Apr 21 2023 zhangrui - 0.69.0-4 +- DESC:add check after malloc allocation + * Thu Jan 5 2023 zhangrui - 0.69.0-3 - DESC:add loongarch