Compare commits
10 Commits
dd18d5af7b
...
f4f65896b8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4f65896b8 | ||
|
|
6f10cc2d28 | ||
|
|
818c935926 | ||
|
|
86046b52e8 | ||
|
|
e85294ae31 | ||
|
|
b882ca7f8a | ||
|
|
9aafa58ab7 | ||
|
|
6927b66849 | ||
|
|
150e04cb74 | ||
|
|
ba56dd5c68 |
@ -1,72 +0,0 @@
|
||||
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
|
||||
|
||||
39
0001-Remove-stray-debugging-code.patch
Normal file
39
0001-Remove-stray-debugging-code.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 1e084b3ac2ec8b4b448c2290ed4fa88e4c4212c4 Mon Sep 17 00:00:00 2001
|
||||
From: Rod Smith <rodsmith@rodsbooks.com>
|
||||
Date: Sat, 9 Oct 2021 15:52:16 -0400
|
||||
Subject: [PATCH] Remove stray debugging code
|
||||
|
||||
---
|
||||
NEWS | 6 ++++++
|
||||
gptcl.cc | 1 -
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 18f6f21..4009a5b 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -1,3 +1,9 @@
|
||||
+1.0.9 (?/?/2021):
|
||||
+-----------------
|
||||
+
|
||||
+- Removed stray debugging code that caused "partNum is {x}" to be printed
|
||||
+ when changing a partition's name with sgdisk (-c/--change-name).
|
||||
+
|
||||
1.0.8 (6/9/2021):
|
||||
-----------------
|
||||
|
||||
diff --git a/gptcl.cc b/gptcl.cc
|
||||
index 65a99e9..ef7156e 100644
|
||||
--- a/gptcl.cc
|
||||
+++ b/gptcl.cc
|
||||
@@ -212,7 +212,6 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
||||
partNum = (int) GetInt(partName, 1) - 1;
|
||||
if (partNum < 0)
|
||||
partNum = newPartNum;
|
||||
- cout << "partNum is " << partNum << "\n";
|
||||
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
|
||||
name = GetString(partName, 2);
|
||||
if (SetName(partNum, (UnicodeString) name.c_str())) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
88
0001-fix-Werror-format-security-error.patch
Normal file
88
0001-fix-Werror-format-security-error.patch
Normal file
@ -0,0 +1,88 @@
|
||||
Subject: fix compiler error for option -Werror=format-security
|
||||
|
||||
After ncurses upgrade to 6.3, it introduces a format-security
|
||||
compile error.
|
||||
To fix it, a format literal string is added.
|
||||
|
||||
Reference: https://gitee.com/src-openeuler/gcc/issues/I4W7ZB
|
||||
|
||||
Signed-off-by: Wei, Qiang <qiang.wei@suse.com>
|
||||
|
||||
---
|
||||
diff --git a/gptcurses.cc b/gptcurses.cc
|
||||
index 1fbaad2..b9402cd 100644
|
||||
--- a/gptcurses.cc
|
||||
+++ b/gptcurses.cc
|
||||
@@ -239,22 +239,22 @@ Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) {
|
||||
ClearLine(lineNum);
|
||||
if (space->partNum == -1) { // space is empty
|
||||
move(lineNum, 12);
|
||||
- printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||
+ printw("%s", BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||
move(lineNum, 24);
|
||||
printw("free space");
|
||||
} else { // space holds a partition
|
||||
move(lineNum, 3);
|
||||
printw("%d", space->partNum + 1);
|
||||
move(lineNum, 12);
|
||||
- printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||
+ printw("%s", BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||
move(lineNum, 24);
|
||||
- printw(space->origPart->GetTypeName().c_str());
|
||||
+ printw("%s", space->origPart->GetTypeName().c_str());
|
||||
move(lineNum, 50);
|
||||
#ifdef USE_UTF16
|
||||
space->origPart->GetDescription().extract(0, 39, temp, 39);
|
||||
printw(temp);
|
||||
#else
|
||||
- printw(space->origPart->GetDescription().c_str());
|
||||
+ printw("%s", space->origPart->GetDescription().c_str());
|
||||
#endif
|
||||
} // if/else
|
||||
} // if
|
||||
@@ -271,10 +271,10 @@ int GPTDataCurses::DisplayParts(int selected) {
|
||||
|
||||
move(lineNum++, 0);
|
||||
theLine = "Part. # Size Partition Type Partition Name";
|
||||
- printw(theLine.c_str());
|
||||
+ printw("%s", theLine.c_str());
|
||||
move(lineNum++, 0);
|
||||
theLine = "----------------------------------------------------------------";
|
||||
- printw(theLine.c_str());
|
||||
+ printw("%s", theLine.c_str());
|
||||
numToShow = LINES - RESERVED_TOP - RESERVED_BOTTOM;
|
||||
pageNum = selected / numToShow;
|
||||
for (i = pageNum * numToShow; i <= (pageNum + 1) * numToShow - 1; i++) {
|
||||
@@ -636,7 +636,7 @@ void GPTDataCurses::DisplayOptions(char selectedKey) {
|
||||
} // if/else
|
||||
} // for
|
||||
move(LINES - 1, (COLS - optionDesc.length()) / 2);
|
||||
- printw(optionDesc.c_str());
|
||||
+ printw("%s", optionDesc.c_str());
|
||||
currentKey = selectedKey;
|
||||
} // if
|
||||
} // GPTDataCurses::DisplayOptions()
|
||||
@@ -748,11 +748,11 @@ void GPTDataCurses::DrawMenu(void) {
|
||||
|
||||
clear();
|
||||
move(0, (COLS - title.length()) / 2);
|
||||
- printw(title.c_str());
|
||||
+ printw("%s", title.c_str());
|
||||
move(2, (COLS - drive.length()) / 2);
|
||||
- printw(drive.c_str());
|
||||
+ printw("%s", drive.c_str());
|
||||
move(3, (COLS - size.str().length()) / 2);
|
||||
- printw(size.str().c_str());
|
||||
+ printw("%s", size.str().c_str());
|
||||
DisplayParts(currentSpaceNum);
|
||||
} // DrawMenu
|
||||
|
||||
@@ -802,7 +802,7 @@ void PromptToContinue(void) {
|
||||
void Report(string theText) {
|
||||
clear();
|
||||
move(0, 0);
|
||||
- printw(theText.c_str());
|
||||
+ printw("%s", theText.c_str());
|
||||
move(LINES - 2, (COLS - 29) / 2);
|
||||
printw("Press any key to continue....");
|
||||
cbreak();
|
||||
27
gdisk.spec
27
gdisk.spec
@ -1,15 +1,15 @@
|
||||
Name: gdisk
|
||||
Version: 1.0.5
|
||||
Release: 4
|
||||
Version: 1.0.8
|
||||
Release: 3
|
||||
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
|
||||
|
||||
Patch1: 0001-Fix-segfault-on-some-weird-data-structures.patch
|
||||
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel
|
||||
|
||||
|
||||
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel git gdb
|
||||
Patch9000: 0001-fix-Werror-format-security-error.patch
|
||||
Patch9001: 0001-Remove-stray-debugging-code.patch
|
||||
|
||||
%description
|
||||
GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools.
|
||||
@ -23,7 +23,7 @@ Requires: man
|
||||
This package contains the man page for GPT fdisk(consisting of the gdisk,sgdisk,cgdisk)
|
||||
|
||||
%prep
|
||||
%autosetup -n gptfdisk-%{version} -p1 -Sgit
|
||||
%autosetup -n gptfdisk-%{version} -p1
|
||||
|
||||
%build
|
||||
make CXXFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64" LDFLAGS="%{build_ldflags}"
|
||||
@ -51,6 +51,21 @@ install -Dp -m 0644 fixparts.8 %{buildroot}%{_mandir}/man8/fixparts.8
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Sat Oct 29 2022 wangzhiqiang <wangzhiqiang95@huawei.com> - 1.0.8-3
|
||||
- remove stray debugging code
|
||||
|
||||
* Tue Mar 8 02:11:35 UTC 2022 - Qiang Wei <qiang.wei@suse.com> - 1.0.8-2
|
||||
- Fix compiler error for option -Werror=format-security
|
||||
|
||||
* Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 1.0.8-1
|
||||
- update to gptfdisk-1.0.8
|
||||
|
||||
* 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-5
|
||||
- remove unnecessary build require.
|
||||
|
||||
* Wed Nov 4 2020 lixiaokeng <lixiaokeng@huawei.com> - 1.0.5-4
|
||||
- add make test
|
||||
|
||||
|
||||
Binary file not shown.
BIN
gptfdisk-1.0.8.tar.gz
Normal file
BIN
gptfdisk-1.0.8.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user