X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournald-native.c;h=ec9afa187de97be3fd9245219843cba637527b24;hp=9d1f39f0c5e855ab999018d95781db4f07381686;hb=fd59d9f29838c3888168554c774003e7ad6d33b0;hpb=c4aa09b06f835c91cea9e021df4c3605cff2318d diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 9d1f39f0c..ec9afa187 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -123,11 +123,12 @@ void server_process_native_message( /* A property follows */ - if (n+N_IOVEC_META_FIELDS >= m) { + /* n received properties, +1 for _TRANSPORT */ + if (n + 1 + N_IOVEC_META_FIELDS >= m) { struct iovec *c; unsigned u; - u = MAX((n+N_IOVEC_META_FIELDS+1) * 2U, 4U); + u = MAX((n + 1 + N_IOVEC_META_FIELDS) * 2U, 4U); c = realloc(iovec, u * sizeof(struct iovec)); if (!c) { log_oom(); @@ -157,23 +158,23 @@ void server_process_native_message( * of this entry for the rate limiting * logic */ if (l == 10 && - memcmp(p, "PRIORITY=", 9) == 0 && + hasprefix(p, "PRIORITY=") && p[9] >= '0' && p[9] <= '9') priority = (priority & LOG_FACMASK) | (p[9] - '0'); else if (l == 17 && - memcmp(p, "SYSLOG_FACILITY=", 16) == 0 && + hasprefix(p, "SYSLOG_FACILITY=") && p[16] >= '0' && p[16] <= '9') priority = (priority & LOG_PRIMASK) | ((p[16] - '0') << 3); else if (l == 18 && - memcmp(p, "SYSLOG_FACILITY=", 16) == 0 && + hasprefix(p, "SYSLOG_FACILITY=") && p[16] >= '0' && p[16] <= '9' && p[17] >= '0' && p[17] <= '9') priority = (priority & LOG_PRIMASK) | (((p[16] - '0')*10 + (p[17] - '0')) << 3); else if (l >= 19 && - memcmp(p, "SYSLOG_IDENTIFIER=", 18) == 0) { + hasprefix(p, "SYSLOG_IDENTIFIER=")) { char *t; t = strndup(p + 18, l - 18); @@ -182,7 +183,7 @@ void server_process_native_message( identifier = t; } } else if (l >= 8 && - memcmp(p, "MESSAGE=", 8) == 0) { + hasprefix(p, "MESSAGE=")) { char *t; t = strndup(p + 8, l - 8);