[systemd-commits] src/journal

Michal Schmidt michich at kemper.freedesktop.org
Tue Apr 16 14:12:26 PDT 2013


 src/journal/journald-native.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit f6422def2c10aa0dea1b872d2f187853e61bd015
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Tue Apr 16 23:07:14 2013 +0200

    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

diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 9d1f39f..f878dfc 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();



More information about the systemd-commits mailing list