- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
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;
|
|
|