mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
Libc: zero sysctl buffer before strncpy
The uname utility from coreutils needs its read buffer zero-terminated, regardless of read length. Fix #2657
This commit is contained in:
parent
4a444651c5
commit
abd536d5d3
@ -90,6 +90,8 @@ extern "C" int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||
if (namelen != 2) return Libc::Errno(ENOENT);
|
||||
if (index_a >= CTL_MAXID) return Libc::Errno(EINVAL);
|
||||
|
||||
Genode::memset(buf, 0x00, *oldlenp);
|
||||
|
||||
switch(index_a) {
|
||||
case CTL_KERN:
|
||||
if (index_b >= KERN_MAXID) return Libc::Errno(EINVAL);
|
||||
|
@ -1,5 +1,11 @@
|
||||
build { core init drivers/timer noux/minimal
|
||||
lib/libc_noux noux-pkg/coreutils }
|
||||
build {
|
||||
core init
|
||||
app/sequence
|
||||
drivers/timer
|
||||
lib/libc_noux
|
||||
noux/minimal
|
||||
noux-pkg/coreutils
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
@ -18,47 +24,58 @@ install_config {
|
||||
<default-route>
|
||||
<any-service> <any-child/> <parent/> </any-service>
|
||||
</default-route>
|
||||
<default caps="256"/>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="spoof">
|
||||
<binary name="noux"/>
|
||||
<start name="sequence">
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<config verbose="yes" stdin="/null" stdout="/log" stderr="/log">
|
||||
<fstab>
|
||||
<null/> <log/>
|
||||
<dir name=".sysctl">
|
||||
<dir name="kern">
|
||||
<inline name="ostype">Muck OS XIII</inline>
|
||||
<inline name="hostname">localhost</inline>
|
||||
</dir>
|
||||
<dir name="hw">
|
||||
<inline name="machine">norisc</inline>
|
||||
</dir>
|
||||
</dir>
|
||||
<tar name="coreutils.tar" />
|
||||
</fstab>
|
||||
<start name="/bin/uname"> <arg value="-a"/> </start>
|
||||
</config>
|
||||
</start>
|
||||
<start name="noux">
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<config verbose="yes" stdin="/null" stdout="/log" stderr="/log">
|
||||
<fstab> <null/> <log/> <tar name="coreutils.tar" /> </fstab>
|
||||
<start name="/bin/uname"> <arg value="-a"/> </start>
|
||||
<config>
|
||||
<start name="spoof">
|
||||
<binary name="noux"/>
|
||||
<config verbose="yes" stdin="/null" stdout="/log" stderr="/log">
|
||||
<fstab>
|
||||
<null/> <log/>
|
||||
<dir name=".sysctl">
|
||||
<dir name="kern">
|
||||
<inline name="ostype">Muck OS XIII</inline>
|
||||
<inline name="hostname">localhost</inline>
|
||||
</dir>
|
||||
<dir name="hw">
|
||||
<inline name="machine">norisc</inline>
|
||||
</dir>
|
||||
</dir>
|
||||
<tar name="coreutils.tar" />
|
||||
</fstab>
|
||||
<start name="/bin/uname"> <arg value="-a"/> </start>
|
||||
</config>
|
||||
</start>
|
||||
<start name="noux">
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<config verbose="yes" stdin="/null" stdout="/log" stderr="/log">
|
||||
<fstab> <null/> <log/> <tar name="coreutils.tar" /> </fstab>
|
||||
<start name="/bin/uname"> <arg value="-a"/> </start>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
build_boot_image {
|
||||
core init timer ld.lib.so noux libc.lib.so libm.lib.so posix.lib.so
|
||||
libc_noux.lib.so coreutils.tar
|
||||
core init ld.lib.so
|
||||
coreutils.tar
|
||||
libc_noux.lib.so
|
||||
libm.lib.so
|
||||
noux libc.lib.so
|
||||
posix.lib.so
|
||||
sequence
|
||||
timer
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -serial mon:stdio "
|
||||
|
||||
# coreutils.tar is really huge when built for x86_64
|
||||
|
||||
run_genode_until {child "noux" exited with exit value 0.*\n} 30
|
||||
run_genode_until {child "sequence" exited with exit value 0.*\n} 30
|
||||
|
Loading…
x
Reference in New Issue
Block a user