Fix null pointer dereference in the child if fdopen fails

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2026-03-16 15:49:18 +01:00
parent f7df78d3ab
commit f4677c89d6
+5 -1
View File
@@ -57,7 +57,11 @@ static void run_child(
FILE *file = fdopen(write_fd, "a");
size_t length = 0;
TEST_ASSERT_ERRNO(file != NULL);
if (file == NULL) {
/* There's no way we can report anything other than the exit code.
* So we might as well quit without even running the child callback. */
goto write_done;
}
child_callback(param, buf, size, &length);