diff --git a/gdisk-1.0.9-poptmisuse.patch b/gdisk-1.0.9-poptmisuse.patch new file mode 100644 index 0000000000000000000000000000000000000000..50566816d4a3a7319a2b49f86e68bbe6fccfff56 --- /dev/null +++ b/gdisk-1.0.9-poptmisuse.patch @@ -0,0 +1,12 @@ +diff -up gptfdisk-1.0.9/gptcl.cc.poptabuse gptfdisk-1.0.9/gptcl.cc +--- gptfdisk-1.0.9/gptcl.cc.poptabuse 2022-08-24 09:08:42.220778357 +0300 ++++ gptfdisk-1.0.9/gptcl.cc 2022-08-24 09:08:53.284872567 +0300 +@@ -156,6 +156,8 @@ int GPTDataCL::DoOptions(int argc, char* + + // Assume first non-option argument is the device filename.... + device = (char*) poptGetArg(poptCon); ++ if (device != NULL) ++ device = strdup(device); + poptResetContext(poptCon); + + if (device != NULL) { diff --git a/gdisk.spec b/gdisk.spec index 2b1cd129ea11d769c4aceef1ebb76bc668b5f81a..74d5c0ac5a751e36d74c1086b5a2fc16dee6878e 100644 --- a/gdisk.spec +++ b/gdisk.spec @@ -1,13 +1,14 @@ -%define anolis_release 1 +%define anolis_release 2 Name: gdisk -Version: 1.0.9 +Version: 1.0.9 Release: %{anolis_release}%{?dist} Summary: An fdisk-like partitioning tool for GPT disks License: GPLv2 URL: http://www.rodsbooks.com/gdisk/ -Source0: http://downloads.sourceforge.net/gptfdisk/gptfdisk-%{version}.tar.gz +Source0: http://downloads.sourceforge.net/gptfdisk/gptfdisk-1.0.9.tar.gz +Patch1: gdisk-1.0.9-poptmisuse.patch BuildRequires: gcc-c++ BuildRequires: make @@ -56,6 +57,8 @@ done %doc NEWS README %changelog +* Mon Sep 15 2025 wenyuzifangtest001 - 1.0.9-2 +- Apply patch to avoid use-after-free bugs and ensure safe memory handling for device arguments * Mon Feb 13 2023 Feng Su - 1.0.9-1 - update to v1.0.9 - add api/abi files