mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 01:27:11 +03:00
journald: filter fields send from client starting with underscore
This commit is contained in:
parent
d0bbc21caa
commit
2b0ba69bb1
@ -376,9 +376,15 @@ static void process_native_message(Server *s, const void *buffer, size_t buffer_
|
|||||||
|
|
||||||
q = memchr(p, '=', e - p);
|
q = memchr(p, '=', e - p);
|
||||||
if (q) {
|
if (q) {
|
||||||
|
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_base = (char*) p;
|
||||||
iovec[n].iov_len = e - p;
|
iovec[n].iov_len = e - p;
|
||||||
n++;
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
remaining -= (e - p) + 1;
|
remaining -= (e - p) + 1;
|
||||||
p = e + 1;
|
p = e + 1;
|
||||||
@ -411,9 +417,12 @@ static void process_native_message(Server *s, const void *buffer, size_t buffer_
|
|||||||
k[e - p] = '=';
|
k[e - p] = '=';
|
||||||
memcpy(k + (e - p) + 1, e + 1 + sizeof(uint64_t), l);
|
memcpy(k + (e - p) + 1, e + 1 + sizeof(uint64_t), l);
|
||||||
|
|
||||||
|
if (k[0] != '_') {
|
||||||
iovec[n].iov_base = k;
|
iovec[n].iov_base = k;
|
||||||
iovec[n].iov_len = (e - p) + 1 + l;
|
iovec[n].iov_len = (e - p) + 1 + l;
|
||||||
n++;
|
n++;
|
||||||
|
} else
|
||||||
|
free(k);
|
||||||
|
|
||||||
remaining -= (e - p) + 1 + sizeof(uint64_t) + l + 1;
|
remaining -= (e - p) + 1 + sizeof(uint64_t) + l + 1;
|
||||||
p = e + 1 + sizeof(uint64_t) + l + 1;
|
p = e + 1 + sizeof(uint64_t) + l + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user