Compare commits

...

13 Commits

Author SHA1 Message Date
openeuler-ci-bot
63ee1fc6f5
!38 fix problem that caused sgdisk to crash when using the latest popt
From: @lv_1245 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-09-27 01:15:26 +00:00
lvyy
3ba820d2e9 fix problem that caused sgdisk to crash when using the latest popt 2024-09-26 03:21:47 +00:00
openeuler-ci-bot
35ddfaa3a3 !19 Synchronize Version
From: @hifi521
Reviewed-by: @wubo009
Signed-off-by: @wubo009
2021-09-30 00:49:18 +00:00
zhanchengbin
fc509e64b2 https://gitee.com/src-openeuler/gdisk/pulls/14
This link is used to synchronize the code, but the version in the spec is not consistent
after the synchronization. Therefore, this commit is used to modify the version in the spec.
2021-09-29 17:31:24 +08:00
openeuler-ci-bot
06e7cbb8b4 !16 [sync] PR-14: Synchronize Version
From: @openeuler-sync-bot
Reviewed-by: @wubo009
Signed-off-by: @wubo009
2021-09-29 03:46:10 +00:00
chenyanpanHW
8e50c2d669 delete -Sgit from %autosetup, and delete BuildRequires git
Conflicts:
	gdisk.spec

(cherry picked from commit 5d90662758b90e135adb766096cd39d2100140fe)
2021-09-29 11:29:50 +08:00
zhouwenpei
a33ddddaaa remove unnecessary build require.
Conflicts:
	gdisk.spec

(cherry picked from commit 9d4103264913d85db024327a5a0151d6879063c8)
2021-09-29 11:29:50 +08:00
lixiaokeng
a63f5c8672 add make test
Conflicts:
	gdisk.spec

(cherry picked from commit 3109068789e9558bd4381c3ad6ed83e54ef8fd61)
2021-09-29 11:29:50 +08:00
Zhiqiang Liu
70cb6b95ef gdisk: backport one patch for solving potential segfault problem
backport one patch for solving potential segfault problem

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>

Conflicts:
	gdisk.spec
(cherry picked from commit b34b8991caf7fd3c6f0a01db9da15c979aaa11d7)
2021-09-29 11:29:50 +08:00
openeuler-ci-bot
e9ec2f9b9d !6 update to 1.0.5 version
Merge pull request !6 from Markeryang/openEuler-20.03-LTS
2020-07-30 19:29:43 +08:00
Markeryang
fef87b3fb3 update to 1.0.5 version
update to 1.0.5 version
2020-07-29 16:47:07 +08:00
Markeryang
2d5c2544bd update to 1.0.5
update to 1.0.5
2020-07-29 16:45:53 +08:00
Markeryang
e0ea4aacc2 删除文件 gptfdisk-1.0.4.tar.gz 2020-07-29 16:44:33 +08:00
6 changed files with 173 additions and 5 deletions

View File

@ -0,0 +1,72 @@
From 81c8bbee46ad6ebacf72eae70ba5147f376205a4 Mon Sep 17 00:00:00 2001
From: Rod Smith <rodsmith@rodsbooks.com>
Date: Mon, 14 Sep 2020 10:08:18 -0400
Subject: [PATCH] Fix segfault on some weird data structures
---
NEWS | 6 ++++++
gpt.cc | 13 ++++++++++++-
support.h | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 54c865e..bac3da3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+1.0.6 (?/??/2020):
+------------------
+
+- Fixed bug that could cause segfault if GPT header claimed partition
+ entries are oversized.
+
1.0.5 (2/17/2020):
------------------
diff --git a/gpt.cc b/gpt.cc
index fe8e956..1b4e10f 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -1041,6 +1041,14 @@ int GPTData::LoadHeader(struct GPTHeader *header, DiskIO & disk, uint64_t sector
} // if
*crcOk = CheckHeaderCRC(&tempHeader);
+ if (tempHeader.sizeOfPartitionEntries != sizeof(GPTPart)) {
+ cerr << "Warning: Partition table header claims that the size of partition table\n";
+ cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " bytes, but this program ";
+ cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
+ cerr << "Adjusting accordingly, but partition table may be garbage.\n";
+ tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
+ }
+
if (allOK && (numParts != tempHeader.numParts) && *crcOk) {
allOK = SetGPTSize(tempHeader.numParts, 0);
}
@@ -1058,7 +1066,10 @@ int GPTData::LoadPartitionTable(const struct GPTHeader & header, DiskIO & disk,
uint32_t sizeOfParts, newCRC;
int retval;
- if (disk.OpenForRead()) {
+ if (header.sizeOfPartitionEntries != sizeof(GPTPart)) {
+ cerr << "Error! GPT header contains invalid partition entry size!\n";
+ retval = 0;
+ } else if (disk.OpenForRead()) {
if (sector == 0) {
retval = disk.Seek(header.partitionEntriesLBA);
} else {
diff --git a/support.h b/support.h
index 9a79b95..978bfe1 100644
--- a/support.h
+++ b/support.h
@@ -8,7 +8,7 @@
#ifndef __GPTSUPPORT
#define __GPTSUPPORT
-#define GPTFDISK_VERSION "1.0.5"
+#define GPTFDISK_VERSION "1.0.5.1"
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d Mon Sep 17 00:00:00 2001
From: Rod Smith <rodsmith@rodsbooks.com>
Date: Fri, 15 Apr 2022 18:10:14 -0400
Subject: [PATCH] Fix failure & crash of sgdisk when compiled with latest popt
(commit 740; presumably eventually release 1.19)
Conflict:no
Reference:https://sourceforge.net/p/gptfdisk/code/ci/5d5e76d369a412bfb3d2cebb5fc0a7509cef878d
---
gptcl.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gptcl.cc b/gptcl.cc
index 34c9421..0d578eb 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -155,7 +155,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
} // while
// Assume first non-option argument is the device filename....
- device = (char*) poptGetArg(poptCon);
+ device = strdup((char*) poptGetArg(poptCon));
poptResetContext(poptCon);
if (device != NULL) {
--
2.33.0

View File

@ -0,0 +1,43 @@
From f5de3401b974ce103ffd93af8f9d43505a04aaf9 Mon Sep 17 00:00:00 2001
From: Damian Kurek <starfire24680@gmail.com>
Date: Thu, 7 Jul 2022 03:39:16 +0000
Subject: [PATCH] Fix NULL dereference when duplicating string argument
poptGetArg can return NULL if there are no additional arguments, which
makes strdup dereference NULL on strlen
Conflict:no
Reference:https://sourceforge.net/p/gptfdisk/code/ci/f5de3401b974ce103ffd93af8f9d43505a04aaf9
---
gptcl.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gptcl.cc b/gptcl.cc
index 0d578eb..ab95239 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -155,10 +155,11 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
} // while
// Assume first non-option argument is the device filename....
- device = strdup((char*) poptGetArg(poptCon));
- poptResetContext(poptCon);
+ device = (char*) poptGetArg(poptCon);
if (device != NULL) {
+ device = strdup(device);
+ poptResetContext(poptCon);
JustLooking(); // reset as necessary
BeQuiet(); // Tell called functions to be less verbose & interactive
if (LoadPartitions((string) device)) {
@@ -498,6 +499,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
cerr << "Error encountered; not saving changes.\n";
retval = 4;
} // if
+ free(device);
} // if (device != NULL)
poptFreeContext(poptCon);
return retval;
--
2.33.0

View File

@ -1,12 +1,16 @@
Name: gdisk
Version: 1.0.4
Release: 5
Version: 1.0.5
Release: 7
Summary: GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools
License: GPLv2
URL: http://www.rodsbooks.com/gdisk
Source0: http://downloads.sourceforge.net/gptfdisk/gptfdisk-%{version}.tar.gz
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel git gdb
Patch0001: 0001-Fix-segfault-on-some-weird-data-structures.patch
Patch0002: 0002-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch
Patch0003: 0003-Fix-NULL-dereference-when-duplicating-string-argumen.patch
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel
%description
GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools.
@ -20,12 +24,15 @@ Requires: man
This package contains the man page for GPT fdisk(consisting of the gdisk,sgdisk,cgdisk)
%prep
%autosetup -n gptfdisk-%{version} -p1 -Sgit
chmod 0644 gdisk_test.sh
%autosetup -n gptfdisk-%{version} -p1
%build
make CXXFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64" LDFLAGS="%{build_ldflags}"
%check
make test
chmod 0644 gdisk_test.sh
%install
install -Dp -m 0755 cgdisk %{buildroot}%{_sbindir}/cgdisk
install -Dp -m 0644 cgdisk.8 %{buildroot}%{_mandir}/man8/cgdisk.8
@ -45,6 +52,24 @@ install -Dp -m 0644 fixparts.8 %{buildroot}%{_mandir}/man8/fixparts.8
%{_mandir}/man8/*
%changelog
* Tue Sep 24 2024 lvyy <lyunmail@163.com> - 1.0.5-7
- DESC: fix problem that caused sgdisk to crash when using the latest popt
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 1.0.5-6
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
* Fri Jul 23 2021 zhouwenpei <zhouwenpei1@huawei.com> - 1.0.5-4
- remove unnecessary build require.
* Wed Nov 4 2020 lixiaokeng <lixiaokeng@huawei.com> - 1.0.5-3
- add make test
* Thu Oct 29 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.0.5-2
- backport one patch for solving potential segfault problem.
* Wed Jul 29 2020 yanglongkang <yanglongkang@huawei.com> - 1.0.5-1
- update to 1.0.5 version
* Wed Jan 22 2020 sunshihao <sunshihao@huawei.com> - 1.0.4.5
- Type:enhancement
- ID:NA

Binary file not shown.

BIN
gptfdisk-1.0.5.tar.gz Normal file

Binary file not shown.