15 Star 3 Fork 69

src-openEuler/util-linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-cfdisk-fix-memory-leak-and-possible-NULL-dereference.patch 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
fly_fzc 提交于 2个月前 . backport community patches
From 33ca468b67d34dead8fb8b41dc9f328971e5fe70 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 25 Mar 2025 12:14:14 +0100
Subject: [PATCH] cfdisk: fix memory leak and possible NULL dereference
[gcc-analyzer]
Signed-off-by: Karel Zak <kzak@redhat.com>
---
disk-utils/cfdisk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index d0bb57aaf15..e8a8b959a0f 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -947,6 +947,7 @@ static void menu_set_title(struct cfdisk_menu *m, const char *title)
m->width = len + MENU_TITLE_PADDING;
str = xstrdup(title);
}
+ free(m->title);
m->title = str;
}
@@ -2173,7 +2174,8 @@ static int ui_create_label(struct cfdisk *cf)
nitems = fdisk_get_nlabels(cf->cxt);
cm = xcalloc(nitems + 1, sizeof(struct cfdisk_menuitem));
- while (fdisk_next_label(cf->cxt, &lb) == 0) {
+ while (fdisk_next_label(cf->cxt, &lb) == 0 && i < nitems) {
+
if (fdisk_label_is_disabled(lb) ||
fdisk_label_get_type(lb) == FDISK_DISKLABEL_BSD)
continue;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/util-linux.git
git@gitee.com:src-openeuler/util-linux.git
src-openeuler
util-linux
util-linux
master

搜索帮助