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:
@@ -48,7 +48,7 @@ class Vfs::Log_file_system : public Single_file_system
|
|||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
int const curr_count = min(count, sizeof(tmp) - 1);
|
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;
|
tmp[curr_count > 0 ? curr_count : 0] = 0;
|
||||||
_log.write(tmp);
|
_log.write(tmp);
|
||||||
count -= curr_count;
|
count -= curr_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user