1 Star 0 Fork 80

houlifei/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-rpmDigestBundleFinal-and-Update-return-code-on-i.patch 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
renxichen 提交于 2023-08-02 16:25 . backport some patches from upstream
From 3a50688558f18cfb250b2e70bc34464a8e089d32 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 20 Jun 2023 09:34:47 +0300
Subject: [PATCH] Fix rpmDigestBundleFinal() and Update() return code on
invalid arguments
Discovered via #2548, these functions merrily return zero for success
when passed NULL data. In rpm nothing bothers to check for their return
codes but it doesn't mean it's the right thing to do
---
rpmio/digest.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/rpmio/digest.c b/rpmio/digest.c
index 1975fe6b9..9c679d820 100644
--- a/rpmio/digest.c
+++ b/rpmio/digest.c
@@ -77,8 +77,9 @@ int rpmDigestBundleAddID(rpmDigestBundle bundle, int algo, int id,
}
int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len)
{
- int rc = 0;
+ int rc = -1;
if (bundle && data && len > 0) {
+ rc = 0;
for (int i = 0; i <= bundle->index_max; i++) {
if (bundle->ids[i] > 0)
rc += rpmDigestUpdate(bundle->digests[i], data, len);
@@ -91,7 +92,7 @@ int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len)
int rpmDigestBundleFinal(rpmDigestBundle bundle, int id,
void ** datap, size_t * lenp, int asAscii)
{
- int rc = 0;
+ int rc = -1;
int ix = findID(bundle, id);
if (ix >= 0) {
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/houlifei_uniontech/rpm.git
git@gitee.com:houlifei_uniontech/rpm.git
houlifei_uniontech
rpm
rpm
master

搜索帮助