daandemeyer / rpms / systemd

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