mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
Noux, libc_terminal: initialize 'stat' buffer
Initialize the 'stat' buffer in the 'stat()' function to avoid potential non-deterministic program behavior. Fixes #362.
This commit is contained in:
parent
8af582fac2
commit
97c3f6599d
@ -162,7 +162,10 @@ namespace {
|
||||
* This is important, i.e., to convince the gdbserver code to
|
||||
* cooperate with us.
|
||||
*/
|
||||
if (buf) buf->st_mode = S_IFCHR;
|
||||
if (buf) {
|
||||
Genode::memset(buf, 0, sizeof(struct stat));
|
||||
buf->st_mode = S_IFCHR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,8 @@ namespace Noux {
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(&sysio->stat_out.st, 0, sizeof(sysio->stat_out.st));
|
||||
|
||||
sysio->stat_out.st.size = status.size;
|
||||
|
||||
sysio->stat_out.st.mode = Sysio::STAT_MODE_FILE | 0777;
|
||||
|
@ -344,11 +344,12 @@ namespace Noux {
|
||||
PDBG("unhandled record type %d", record->type());
|
||||
}
|
||||
|
||||
sysio->stat_out.st.mode = mode;
|
||||
sysio->stat_out.st.size = record->size();
|
||||
sysio->stat_out.st.uid = record->uid();
|
||||
sysio->stat_out.st.gid = record->gid();
|
||||
sysio->stat_out.st.inode = (unsigned long)record;
|
||||
memset(&sysio->stat_out.st, 0, sizeof(sysio->stat_out.st));
|
||||
sysio->stat_out.st.mode = mode;
|
||||
sysio->stat_out.st.size = record->size();
|
||||
sysio->stat_out.st.uid = record->uid();
|
||||
sysio->stat_out.st.gid = record->gid();
|
||||
sysio->stat_out.st.inode = (unsigned long)record;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user