mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-23 22:16:16 +01:00
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
This commit is contained in:
parent
c58be7d569
commit
1f8390c002
@ -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 ();
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user