[PATCH] genl: Fix casting error
by Tim Kourt
Fix for the cros-compilation with Chromium OS’s toolchain that
uses GCC 4.9
---
ell/genl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/genl.c b/ell/genl.c
index cff3a9a..d9cfddb 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -498,7 +498,7 @@ static bool received_data(struct l_io *io, void *user_data)
group = pktinfo.group;
}
- for (nlmsg = iov.iov_base; NLMSG_OK(nlmsg, bytes_read);
+ for (nlmsg = iov.iov_base; NLMSG_OK(nlmsg, (uint32_t) bytes_read);
nlmsg = NLMSG_NEXT(nlmsg, bytes_read)) {
if (group > 0)
process_multicast(genl, group, nlmsg);
--
2.9.4
3 years, 7 months
[PATCH] dbus: Fix use-after-free in property changed signals
by Mat Martineau
Configuring with --enable-asan and running test-dbus-properties revealed
that properties_set_complete() was accessing a reply message after it
was sent, but l_dbus_send() had already unref'd and freed the message.
Grabbing a reference to the reply before sending fixes the problem.
---
ell/dbus-service.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ell/dbus-service.c b/ell/dbus-service.c
index 5ee7d27..17e9053 100644
--- a/ell/dbus-service.c
+++ b/ell/dbus-service.c
@@ -1781,7 +1781,7 @@ static void properties_set_complete(struct l_dbus *dbus,
l_dbus_message_set_arguments(reply, "");
}
- l_dbus_send(dbus, reply);
+ l_dbus_send(dbus, l_dbus_message_ref(reply));
if (!l_dbus_message_is_error(reply)) {
l_dbus_message_get_arguments(message, "ssv", &interface_name,
@@ -1793,6 +1793,7 @@ static void properties_set_complete(struct l_dbus *dbus,
}
l_dbus_message_unref(message);
+ l_dbus_message_unref(reply);
}
static struct l_dbus_message *properties_set(struct l_dbus *dbus,
--
2.13.2
3 years, 7 months
[PATCH] unit: Clean up leaks in test-dbus-watch
by Mat Martineau
Use of the internal _dbus_message_set_sender() function in
test-dbus-watch resulted in message structures that were not completely
freed, which caused error reports when ELL was configured with
--enable-asan. Manually clearing the message sender resolves the
problem.
---
unit/test-dbus-watch.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/unit/test-dbus-watch.c b/unit/test-dbus-watch.c
index 6b7bcda..c6e4a92 100644
--- a/unit/test-dbus-watch.c
+++ b/unit/test-dbus-watch.c
@@ -228,6 +228,7 @@ static void test_filter_tree(const void *test_data)
"", ":1.101");
_dbus_message_set_sender(message, DBUS_SERVICE_DBUS);
_dbus_filter_dispatch(message, filter);
+ _dbus_message_set_sender(message, NULL);
l_dbus_message_unref(message);
message = _dbus_message_new_signal(2, DBUS_PATH_DBUS,
@@ -236,12 +237,14 @@ static void test_filter_tree(const void *test_data)
l_dbus_message_set_arguments(message, "");
_dbus_message_set_sender(message, DBUS_SERVICE_DBUS);
_dbus_filter_dispatch(message, filter);
+ _dbus_message_set_sender(message, NULL);
l_dbus_message_unref(message);
message = _dbus_message_new_signal(2, DBUS_PATH_DBUS, "foo", "Bar");
l_dbus_message_set_arguments(message, "");
_dbus_message_set_sender(message, DBUS_SERVICE_DBUS);
_dbus_filter_dispatch(message, filter);
+ _dbus_message_set_sender(message, NULL);
l_dbus_message_unref(message);
message = _dbus_message_new_signal(2, "/", "foo", "Bar");
@@ -251,6 +254,7 @@ static void test_filter_tree(const void *test_data)
_dbus_message_set_sender(message, "org.bar");
_dbus_filter_dispatch(message, filter);
+ _dbus_message_set_sender(message, NULL);
l_dbus_message_unref(message);
assert(test.calls[0] == 3 && test.calls[1] == 2 &&
--
2.13.2
3 years, 7 months
[PATCH 0/5] Bug fixes, new compiler warnings, and test enhancements
by Mat Martineau
When I tried to build ELL using gcc 7.1.1 it failed due to some switch case
fall-throughs. One of those was an actual bug.
Patches 1 and 2 are the most critical. They fix the settings bug and add test
code to trigger the bug and verify the fix.
Patch 3 does not change run-time behavior, but does fix siphash compilation
under gcc 7.
The last two patches are test enhancements that I sent previously but were not
applied.
Mat Martineau (5):
settings: Fix string escaping bug
unit: Better coverage of escaped characters in settings strings
siphash: Fix fallthrough compiler warnings
unit: Add DH test case where results have leading zeros
unit: Make checksum unit tests verify checksum results
ell/settings.c | 1 +
ell/siphash.c | 6 +++++
unit/test-checksum.c | 66 +++++++++++++++++++++++++++-------------------------
unit/test-key.c | 19 +++++++++++++++
unit/test-settings.c | 10 ++++++++
5 files changed, 70 insertions(+), 32 deletions(-)
--
2.13.2
3 years, 7 months