Skip to content
Snippets Groups Projects
Commit d7f48fd0 authored by Bernhard Rosenkränzer's avatar Bernhard Rosenkränzer
Browse files

ptest-runner: Fix incorrect allocation


argv needs to hold 2 char pointers, not 2 chars.
Found by enabling toolchain security options.

Signed-off-by: default avatarBernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
parent 998c52fb
No related branches found
No related tags found
No related merge requests found
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;
# SPDX-FileCopyrightText: Huawei Inc.
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Huawei Inc.
# SPDX-License-Identifier: Apache-2.0
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI_append = " file://ptest-runner-fix-incorrect-allocation.patch"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment