Skip to content

Commit c58fc4f

Browse files
DavidKorczynskinokute78
authored andcommitted
in_exec_wasi: fix possible NULL deref
`tmpfile()` can return NULL and this is not checked for at the moment. If indeed it returns NULL then the call on line 70 `fileno(stdoutp)` will cause a NULL dereference. Signed-off-by: David Korczynski <[email protected]>
1 parent fb7d4c8 commit c58fc4f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/in_exec_wasi/in_exec_wasi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ static int in_exec_wasi_collect(struct flb_input_instance *ins,
5959
size_t out_size = 0;
6060
struct flb_time out_time;
6161

62+
/* Validate the temporary file was created */
63+
if (stdoutp == NULL) {
64+
return -1;
65+
}
66+
6267
if (ctx->oneshot == FLB_TRUE) {
6368
ret = flb_pipe_r(ctx->ch_manager[0], &val, sizeof(val));
6469
if (ret == -1) {

0 commit comments

Comments
 (0)