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:
Christian Helmuth 2014-06-05 15:24:50 +02:00
parent 220f57cdcf
commit bf158017da
1 changed files with 1 additions and 1 deletions

View File

@ -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;