mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-15 15:07:16 +00:00
vfs: really write _count_ bytes in log file system
Genode::strncpy() enures the destination string is null terminated by writing a null-byte. In this case, the null-bytes always overwrote the last character of the output byte stream.
This commit is contained in:
parent
220f57cdcf
commit
bf158017da
@ -48,7 +48,7 @@ class Vfs::Log_file_system : public Single_file_system
|
||||
while (count > 0) {
|
||||
char tmp[128];
|
||||
int const curr_count = min(count, sizeof(tmp) - 1);
|
||||
strncpy(tmp, src, curr_count);
|
||||
memcpy(tmp, src, curr_count);
|
||||
tmp[curr_count > 0 ? curr_count : 0] = 0;
|
||||
_log.write(tmp);
|
||||
count -= curr_count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user