From d7f48fd03a1b417c8415e72d61d1d5a4d041090f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bernhard.rosenkraenzer.ext@huawei.com> Date: Thu, 2 Sep 2021 11:01:35 +0200 Subject: [PATCH] ptest-runner: Fix incorrect allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit argv needs to hold 2 char pointers, not 2 chars. Found by enabling toolchain security options. Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com> --- ...test-runner-fix-incorrect-allocation.patch | 22 +++++++++++++++++++ ...ner-fix-incorrect-allocation.patch.license | 2 ++ .../ptest-runner/ptest-runner_2.4.0.bbappend | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch create mode 100644 meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch.license create mode 100644 meta-ohos-core/recipes-support/ptest-runner/ptest-runner_2.4.0.bbappend diff --git a/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch new file mode 100644 index 00000000..872a8faa --- /dev/null +++ b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch @@ -0,0 +1,22 @@ +From bernhard.rosenkraenzer.ext@huawei.com Thu Sep 2 10:54:01 2021 +From: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com> +Date: Thu, 2 Sep 2021 10:54:01 +0100 +Subject: [PATCH] Fix bogus allocation + +argv needs to hold 2 character pointers, not just 2 characters. + +Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com> +Upstream-Status: Inappropriate [fixed differently upstream] + +diff -up git/utils.c.omv~ git/utils.c +--- git/utils.c.omv~ 2021-09-02 10:18:46.061467114 +0200 ++++ git/utils.c 2021-09-02 10:21:13.011651255 +0200 +@@ -268,7 +268,7 @@ close_fds(void) + static inline void + run_child(char *run_ptest, int fd_stdout, int fd_stderr) + { +- char **argv = malloc(sizeof(char) * 2); ++ char **argv = malloc(sizeof(char*) * 2); + chdir(dirname(strdup(run_ptest))); + + argv[0] = run_ptest; diff --git a/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch.license b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch.license new file mode 100644 index 00000000..2a2d9f5d --- /dev/null +++ b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner/ptest-runner-fix-incorrect-allocation.patch.license @@ -0,0 +1,2 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# SPDX-License-Identifier: Apache-2.0 diff --git a/meta-ohos-core/recipes-support/ptest-runner/ptest-runner_2.4.0.bbappend b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner_2.4.0.bbappend new file mode 100644 index 00000000..09b7059f --- /dev/null +++ b/meta-ohos-core/recipes-support/ptest-runner/ptest-runner_2.4.0.bbappend @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# SPDX-License-Identifier: Apache-2.0 + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI_append = " file://ptest-runner-fix-incorrect-allocation.patch" -- GitLab