teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0163-bus-message-let-s-always-use-EBADMSG-when-the-messag.patch

4bff0a
From 3924b6cf7e42e624a4bcf10f4f0cac3f717ecb5f Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Mon, 9 Jul 2018 11:12:33 +0200
4bff0a
Subject: [PATCH] bus-message: let's always use -EBADMSG when the message is
4bff0a
 bad
4bff0a
4bff0a
-EINVAL means the arguments were somehow wrong, so translate the code we get
4bff0a
internally into -EBADMSG when returning.
4bff0a
4bff0a
(cherry picked from commit 69bd42ca072dfb2f7603b1f82053063293ab54b5)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 src/libsystemd/sd-bus/bus-message.c                |   2 ++
4bff0a
 .../crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e | Bin 0 -> 93 bytes
4bff0a
 2 files changed, 2 insertions(+)
4bff0a
 create mode 100644 test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e
4bff0a
4bff0a
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
4bff0a
index 1d06fcb80e..83f17436a1 100644
4bff0a
--- a/src/libsystemd/sd-bus/bus-message.c
4bff0a
+++ b/src/libsystemd/sd-bus/bus-message.c
4bff0a
@@ -5414,6 +5414,8 @@ int bus_message_parse_fields(sd_bus_message *m) {
4bff0a
                                 &m->root_container.item_size,
4bff0a
                                 &m->root_container.offsets,
4bff0a
                                 &m->root_container.n_offsets);
4bff0a
+                if (r == -EINVAL)
4bff0a
+                        return -EBADMSG;
4bff0a
                 if (r < 0)
4bff0a
                         return r;
4bff0a
         }
4bff0a
diff --git a/test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e b/test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e
4bff0a
new file mode 100644
4bff0a
index 0000000000000000000000000000000000000000..2ae1a8715a12c65fba27d8e60216112a99b0ace7
4bff0a
GIT binary patch
4bff0a
literal 93
4bff0a
wcmd1FDP>|PH8L_f3B<@i03SeB2xg~!`?q0o*WZ8t85
4bff0a
4bff0a
literal 0
4bff0a
HcmV?d00001
4bff0a