[glib/glib-2-70: 3/4] gdbusmessage: Remove arbitrary restriction on minimum D-Bus blob length
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-70: 3/4] gdbusmessage: Remove arbitrary restriction on minimum D-Bus blob length
- Date: Tue, 23 Nov 2021 13:26:01 +0000 (UTC)
commit a5f53c7d005690ededc5a225766e3df08107369d
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Nov 23 12:57:29 2021 +0000
gdbusmessage: Remove arbitrary restriction on minimum D-Bus blob length
The code in `g_dbus_message_new_from_blob()` has now been fixed to
correctly error out on all truncated messages, so there’s no need for an
arbitrary programmer error if the input is too short to contain a valid
D-Bus message header.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #2528
gio/gdbusmessage.c | 1 -
gio/tests/gdbus-serialization.c | 6 ++----
2 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index cbd9e087c..0b803bc30 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -2168,7 +2168,6 @@ g_dbus_message_new_from_blob (guchar *blob,
g_return_val_if_fail (blob != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- g_return_val_if_fail (blob_len >= 12, NULL);
message = g_dbus_message_new ();
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index df1c63ca2..4f0634cf1 100644
--- a/gio/tests/gdbus-serialization.c
+++ b/gio/tests/gdbus-serialization.c
@@ -1512,10 +1512,8 @@ test_message_parse_truncated (void)
g_clear_object (&message);
- /* 12 bytes is the minimum size of the D-Bus message header. Anything less
- * than that is rejected as a programming error by
- * g_dbus_message_new_from_blob(). */
- for (gsize i = 12; i < size; i++)
+ /* Try parsing all possible prefixes of the full @blob. */
+ for (gsize i = 0; i < size; i++)
{
message2 = g_dbus_message_new_from_blob (blob, i, G_DBUS_CAPABILITY_FLAGS_NONE, &error);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]