X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournald.c;h=f0f5103bf038b485d8e9963874a331a54a7a886a;hb=2bd3c38a44c5c3acbf5afdb9c0bcbaf4a72dac3f;hp=d27cb60ac7e7791b137c4c9a7c44859e544272dd;hpb=0071d9f1db6dc9a1035cf5afb81455b67ed462f6;p=elogind.git diff --git a/src/journal/journald.c b/src/journal/journald.c index d27cb60ac..f0f5103bf 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -1259,6 +1258,7 @@ static void process_native_message( p = e + 1; continue; } else { + le64_t l_le; uint64_t l; char *k; @@ -1267,8 +1267,8 @@ static void process_native_message( break; } - memcpy(&l, e + 1, sizeof(uint64_t)); - l = le64toh(l); + memcpy(&l_le, e + 1, sizeof(uint64_t)); + l = le64toh(l_le); if (remaining < e - p + 1 + sizeof(uint64_t) + l + 1 || e[1+sizeof(uint64_t)+l] != '\n') { @@ -2149,10 +2149,20 @@ static int process_event(Server *s, struct epoll_event *ev) { size_t label_len = 0; union { struct cmsghdr cmsghdr; + + /* We use NAME_MAX space for the + * SELinux label here. The kernel + * currently enforces no limit, but + * according to suggestions from the + * SELinux people this will change and + * it will probably be identical to + * NAME_MAX. For now we use that, but + * this should be updated one day when + * the final limit is known.*/ uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(struct timeval)) + - CMSG_SPACE(sizeof(int)) + - CMSG_SPACE(PAGE_SIZE)]; /* selinux label */ + CMSG_SPACE(sizeof(int)) + /* fd */ + CMSG_SPACE(NAME_MAX)]; /* selinux label */ } control; ssize_t n; int v;