7 Star 0 Fork 19

src-openEuler/libblockdev

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0005-part-Fix-potential-double-free-when-getting-parttype.patch 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
kouwq 提交于 2024-07-22 13:55 +08:00 . Fix double free in crypto.c and part.c
From 32a3ec7e47243ea2c2530445df83f60f992f0c23 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 6 Nov 2023 18:38:34 +0100
Subject: [PATCH] part: Fix potential double free when getting parttype
fdisk_partition_get_type returns a pointer to a static table so
we shouldn't free it. fdisk_unref_parttype should against this but
we see some double free crashes that could be caused by this.
Related: https://github.com/storaged-project/udisks/issues/1208
---
src/plugins/part.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/plugins/part.c b/src/plugins/part.c
index 46d31137..20bb3628 100644
--- a/src/plugins/part.c
+++ b/src/plugins/part.c
@@ -462,7 +462,6 @@ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_nu
if (!ptype_string) {
g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL,
"Failed to get partition type for partition %d on device '%s'", part_num, device);
- fdisk_unref_parttype (ptype);
fdisk_unref_partition (pa);
close_context (cxt);
return NULL;
@@ -470,7 +469,6 @@ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_nu
ret = g_strdup (ptype_string);
- fdisk_unref_parttype (ptype);
fdisk_unref_partition (pa);
close_context (cxt);
return ret;
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libblockdev.git
git@gitee.com:src-openeuler/libblockdev.git
src-openeuler
libblockdev
libblockdev
master

搜索帮助