summaryrefslogtreecommitdiff
path: root/src/journal/journald-native.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2013-04-16 23:07:14 +0200
committerMichal Schmidt <mschmidt@redhat.com>2013-04-16 23:07:14 +0200
commitf6422def2c10aa0dea1b872d2f187853e61bd015 (patch)
tree5e8dca64f2330d41facf99dfbcb55fbb2ed373b1 /src/journal/journald-native.c
parent49aa47c7fb6c6cf85f2780080e89181974efdc3b (diff)
journal: fix off-by-one error in native message iovec counting
Thanks to Cristian Ciupitu for a reproducer. https://bugzilla.redhat.com/show_bug.cgi?id=924359
Diffstat (limited to 'src/journal/journald-native.c')
-rw-r--r--src/journal/journald-native.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 9d1f39f0c5..f878dfc911 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();