daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff6046
From f6af2bfe4b353b25a61c362c3ada9be06c8f15c9 Mon Sep 17 00:00:00 2001
ff6046
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
ff6046
Date: Fri, 3 Aug 2018 18:05:27 +0200
ff6046
Subject: [PATCH] bus-message: output debug information about offset troubles
ff6046
ff6046
(cherry picked from commit 0b4775b52747bebf7ecb62062798475629767044)
ff6046
ff6046
Resolves: #1696224
ff6046
---
ff6046
 src/libsystemd/sd-bus/bus-message.c | 5 ++++-
ff6046
 1 file changed, 4 insertions(+), 1 deletion(-)
ff6046
ff6046
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
ff6046
index 153cdf933b..09e72d89dd 100644
ff6046
--- a/src/libsystemd/sd-bus/bus-message.c
ff6046
+++ b/src/libsystemd/sd-bus/bus-message.c
ff6046
@@ -3845,8 +3845,11 @@ static int build_struct_offsets(
ff6046
                                         x = size - (n_variable * sz);
ff6046
 
ff6046
                                 offset = m->rindex + x;
ff6046
-                                if (offset < start)
ff6046
+                                if (offset < start) {
ff6046
+                                        log_debug("For type %s with alignment %zu, message specifies offset %zu which is smaller than previous end %zu + alignment = %zu",
ff6046
+                                                  t, align, offset, previous, start);
ff6046
                                         return -EBADMSG;
ff6046
+                                }
ff6046
                         } else
ff6046
                                 /* Fixed size */
ff6046
                                 offset = start + k;