From bf158017dab9de5d503942a7ac65dfe1cb564fce Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Thu, 5 Jun 2014 15:24:50 +0200 Subject: [PATCH] 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. --- repos/os/include/vfs/log_file_system.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/os/include/vfs/log_file_system.h b/repos/os/include/vfs/log_file_system.h index 63a92e32c5..225a412a30 100644 --- a/repos/os/include/vfs/log_file_system.h +++ b/repos/os/include/vfs/log_file_system.h @@ -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;