diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-12-17 01:36:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-12-17 01:36:47 +0100 |
commit | 2b0ba69bb127b6b1d76512ce32fc9cfd89670f97 (patch) | |
tree | 239ac75a65688add2d7e8dc4e0493f5a77b39a27 /src/journal | |
parent | d0bbc21caa6e68693a47db60c93e99422bf2a858 (diff) |
journald: filter fields send from client starting with underscore
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 6b774f499d..630ead0053 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -376,9 +376,15 @@ static void process_native_message(Server *s, const void *buffer, size_t buffer_ q = memchr(p, '=', e - p); if (q) { - iovec[n].iov_base = (char*) p; - iovec[n].iov_len = e - p; - n++; + if (p[0] != '_') { + /* If the field name starts with an + * underscore, skip the variable, + * since that indidates a trusted + * field */ + iovec[n].iov_base = (char*) p; + iovec[n].iov_len = e - p; + n++; + } remaining -= (e - p) + 1; p = e + 1; @@ -411,9 +417,12 @@ static void process_native_message(Server *s, const void *buffer, size_t buffer_ k[e - p] = '='; memcpy(k + (e - p) + 1, e + 1 + sizeof(uint64_t), l); - iovec[n].iov_base = k; - iovec[n].iov_len = (e - p) + 1 + l; - n++; + if (k[0] != '_') { + iovec[n].iov_base = k; + iovec[n].iov_len = (e - p) + 1 + l; + n++; + } else + free(k); remaining -= (e - p) + 1 + sizeof(uint64_t) + l + 1; p = e + 1 + sizeof(uint64_t) + l + 1; |