From nobody Tue Nov 22 10:42:56 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NGgns15b7z4jXGm; Tue, 22 Nov 2022 10:42:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NGgns0gYCz3vsC; Tue, 22 Nov 2022 10:42:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669113777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ITRYpxdF5qG0KQl5qNLKdzofAtPiGs0vf3R64Yk8dHc=; b=sgTgvDsEu7BKOqRmPp6X1Hz8YRF+L545V4HJ+OsMST2ePqTr/RvbwV0TO8Pw+HakVa/gjf U6Xu+5aCXCdsi0Am/+DWPbA6SuEtDIx6j8+COGGSfD2Rln8F7z9Km4Z0RxAPNVmWrgvyQo /3BN161jaI8iJwiAFSmfslVuHBkEim0Pi/PYuLlWFcTyQOzq2WDLruDw2jT7ljDt0rS9Pl 2sK34WZZ8WGyDrumS5+J2Jg7h1Y2B0P9VOxdQ8A34svKvZIY6MtoIJENn6BHrHgsNmO+pp ZOd/gCytcpzhKGnDToyxf8fRufDlP6/gzzxxi5NW9ahVnwuudLnztgAKq299tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669113777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ITRYpxdF5qG0KQl5qNLKdzofAtPiGs0vf3R64Yk8dHc=; b=juvqP3nNDHxnw1J8JnyRUJn+tCUhzw4LBw+Pw3QBV0E0sA+RUxFU5V5ttRbCPWQnBGWZmK MylFAXV1zjNZeQWPR87AFn/wBRkTE6yh8CzG8QsSBWIE/0E1oOLhcPqOX/cMBj7MQDKuB9 Si9cC5W4paarlRDpS60Vbty1eniatO8p+iSPUh6zMyhtQVhkPKdc6gAixffXMaSVHLC6Vv rkUyFXHPX77AhBp6hlclmjVRV2XKTE3OhmqHCamW2ot+hS6wT4dhdaqUIH+NYS+jHDY8Sy yomskw7GWMN1gQFe2ikRv0xruMih0bB5oaF9OWVkUYofkyJy+HDFfIUOQLgneQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669113777; a=rsa-sha256; cv=none; b=HEHBuNoGH27ldrtkfLDnQE5VU2bcGasCiqwwC3bFaU9QFUh1+vPrlIkirSn6rAq1HoWEQr VSc+ZLPR3gpTNYrLMQBcWbLnCYXQuY/kRIk3NTuUsp/OfVuWyhNe0GH8SSGXpB+mV+t2wq Qfbs/+NV0XFSyh5XyhUxP/W0W8KPovNU/nubFrElnfX2S1LjKgl4xwohdi2P6LySy/Zcjb GvG9VBo1MMYbHOW7R+haU1cJgqy+wgDGiCrOD4+5tfRb0nQwpFixe7FCg+HS5rN82iSqU8 GewGAsDc6U6+NDccLr0BPA30BC+/UORi2NxtYRVY5c+QyzHUHilERQVSCGPVxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NGgnr6rvkzgHL; Tue, 22 Nov 2022 10:42:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AMAgu1v057313; Tue, 22 Nov 2022 10:42:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AMAguCa057312; Tue, 22 Nov 2022 10:42:56 GMT (envelope-from git) Date: Tue, 22 Nov 2022 10:42:56 GMT Message-Id: <202211221042.2AMAguCa057312@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Baptiste Daroussin Subject: git: a8178eb7264b - main - sysutils/gdisk: fix memory corruption while using sgdisk command List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8178eb7264b6be494206d37141bd67827883488 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=a8178eb7264b6be494206d37141bd67827883488 commit a8178eb7264b6be494206d37141bd67827883488 Author: Baptiste Daroussin AuthorDate: 2022-11-22 10:08:49 +0000 Commit: Baptiste Daroussin CommitDate: 2022-11-22 10:10:42 +0000 sysutils/gdisk: fix memory corruption while using sgdisk command while parsing arguments, the device (last argument) variable is reset before being used. --- sysutils/gdisk/Makefile | 2 +- sysutils/gdisk/files/patch-gptcl.cc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sysutils/gdisk/Makefile b/sysutils/gdisk/Makefile index e3e3a34d3a94..52443cd3ee63 100644 --- a/sysutils/gdisk/Makefile +++ b/sysutils/gdisk/Makefile @@ -1,6 +1,6 @@ PORTNAME= gdisk PORTVERSION= 1.0.9 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= SF/gptfdisk/gptfdisk/${PORTVERSION} DISTNAME= gptfdisk-${PORTVERSION} diff --git a/sysutils/gdisk/files/patch-gptcl.cc b/sysutils/gdisk/files/patch-gptcl.cc new file mode 100644 index 000000000000..19e73564d9d0 --- /dev/null +++ b/sysutils/gdisk/files/patch-gptcl.cc @@ -0,0 +1,33 @@ +--- gptcl.cc.orig 2022-11-22 09:31:13 UTC ++++ gptcl.cc +@@ -71,7 +71,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { + uint64_t low, high, startSector, endSector, sSize, mainTableLBA; + uint64_t temp; // temporary variable; free to use in any case + char *device; +- string cmd, typeGUID, name; ++ string cmd, typeGUID, name, devstr; + PartType typeHelper; + + struct poptOption theOptions[] = +@@ -156,9 +156,11 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { + + // Assume first non-option argument is the device filename.... + device = (char*) poptGetArg(poptCon); ++ if (device != NULL) ++ devstr = device; + poptResetContext(poptCon); + +- if (device != NULL) { ++ if (devstr.empty()) { + JustLooking(); // reset as necessary + BeQuiet(); // Tell called functions to be less verbose & interactive + if (LoadPartitions(devstr)) { +@@ -498,7 +500,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { + cerr << "Error encountered; not saving changes.\n"; + retval = 4; + } // if +- } // if (device != NULL) ++ } // if (devstr empty) + poptFreeContext(poptCon); + return retval; + } // GPTDataCL::DoOptions()