From aac3163fcad9af3c440469d95d17c877992a0a26 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 28 Aug 2024 00:52:51 +1200 Subject: [PATCH] Use `std::vector` instead of variable-length array Resolves #3802 --- src/FdTable.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FdTable.cc b/src/FdTable.cc index c2d02a75a83..154e7baa413 100644 --- a/src/FdTable.cc +++ b/src/FdTable.cc @@ -227,8 +227,8 @@ void FdTable::init_syscallbuf_fds_disabled(Task* t) { return; } - char disabled[syscallbuf_fds_disabled_size]; - memset(disabled, 0, sizeof(disabled)); + vector disabled; + disabled.resize(syscallbuf_fds_disabled_size, 0); // It's possible that some tasks in this address space have a different // FdTable. We need to disable syscallbuf for an fd if any tasks for this @@ -249,8 +249,8 @@ void FdTable::init_syscallbuf_fds_disabled(Task* t) { } auto addr = REMOTE_PTR_FIELD(t->preload_globals, syscallbuf_fd_class[0]); - rt->write_mem(addr, disabled, syscallbuf_fds_disabled_size); - rt->record_local(addr, disabled, syscallbuf_fds_disabled_size); + rt->write_mem(addr, disabled.data(), syscallbuf_fds_disabled_size); + rt->record_local(addr, disabled.data(), syscallbuf_fds_disabled_size); } void FdTable::close_after_exec(ReplayTask* t, const vector& fds_to_close) {