mirror of
https://git.yoctoproject.org/poky
synced 2026-05-02 18:32:15 +02:00
gptfdisk: add follow-up patch to fix with current popt
sgdisk still segfaults for some tasks (e.g 'sgdisk -v', 'sgdisk -V') Add a follow-up patch that fixes the issue. It was taken from Archlinux (From OE-Core rev: b2f3f8ced22da68eecd7689cc09e28f70100bd56) Signed-off-by: Markus Volk <f_l_k@t-online.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
7d968ddf80
commit
a78842a19a
@@ -0,0 +1,41 @@
|
||||
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
|
||||
|
||||
Upstream-Status: Submitted [https://sourceforge.net/p/gptfdisk/code/merge-requests/28/]
|
||||
|
||||
---
|
||||
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;
|
||||
|
||||
@@ -12,6 +12,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${PV}/${BP}.tar.gz \
|
||||
file://0001-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch \
|
||||
file://0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch \
|
||||
file://0001-Use-64bit-time_t-on-linux-as-well.patch \
|
||||
file://popt-1.19-follow-up.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "dafead2693faeb8e8b97832b23407f6ed5b3219bc1784f482dd855774e2d50c2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user