summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-bus/bus-message.c3
-rw-r--r--src/libsystemd-bus/bus-socket.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 5783140cf8..721dafe38b 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -3568,6 +3568,9 @@ int bus_message_seal(sd_bus_message *m, uint64_t serial) {
if (m->n_containers > 0)
return -EBADMSG;
+ if (m->poisoned)
+ return -ESTALE;
+
/* If there's a non-trivial signature set, then add it in here */
if (!isempty(m->root_container.signature)) {
r = message_append_field_signature(m, SD_BUS_MESSAGE_HEADER_SIGNATURE, m->root_container.signature, NULL);
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index 4dafe1fdb7..4a07869157 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -72,7 +72,7 @@ static int append_iovec(sd_bus_message *m, const void *p, size_t sz) {
static int bus_message_setup_iovec(sd_bus_message *m) {
struct bus_body_part *part;
- unsigned n;
+ unsigned n, i;
int r;
assert(m);
@@ -102,7 +102,7 @@ static int bus_message_setup_iovec(sd_bus_message *m) {
return r;
}
- for (part = &m->body; part && part->size > 0; part = part->next) {
+ for (i = 0, part = &m->body; i < m->n_body_parts; i++, part = part->next) {
r = append_iovec(m, part->data, part->size);
if (r < 0)
return r;