Reduce the maximum LOG session string length

The maximum possible string length is defined by the platform with the
lowest maximum IPC payload size (currently OKL4).

Fixes #1919
This commit is contained in:
Christian Prochaska 2016-03-21 14:20:37 +01:00 committed by Christian Helmuth
parent a1239c5e9d
commit 146c694513
3 changed files with 6 additions and 3 deletions

View File

@ -28,7 +28,10 @@ struct Genode::Log_session : Session
virtual ~Log_session() { }
typedef Rpc_in_buffer<256> String;
/* the lowest platform-specific maximum IPC payload size (OKL4) */
enum { MAX_STRING_LEN = 236};
typedef Rpc_in_buffer<MAX_STRING_LEN> String;
/**
* Output null-terminated string

View File

@ -27,7 +27,7 @@ class Log_console : public Console
{
private:
enum { _BUF_SIZE = 216 };
enum { _BUF_SIZE = Log_session::MAX_STRING_LEN };
Log_connection _log;
char _buf[_BUF_SIZE];

View File

@ -47,7 +47,7 @@ class Vfs::Log_file_system : public Single_file_system
/* count does not include the trailing '\0' */
while (count > 0) {
char tmp[256];
char tmp[Genode::Log_session::MAX_STRING_LEN];
int const curr_count = min(count, sizeof(tmp) - 1);
memcpy(tmp, src, curr_count);
tmp[curr_count > 0 ? curr_count : 0] = 0;