]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_string_skip_blank(): Let the final assert follow the previous search
authorRalf Habacker <ralf.habacker@freenet.de>
Thu, 19 Jan 2023 15:17:43 +0000 (16:17 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 8 Feb 2023 12:03:30 +0000 (12:03 +0000)
This appears to have been a copy/paste mistake. If only blanks (defined as
spaces or tabs) were removed, then it cannot be right to check for white
space (defined as spaces, tabs, carriage return or linefeed) afterwards.

If libdbus was compiled with assertions enabled, then this is a
denial-of-service issue for dbus-daemon or other users of DBusServer:
an unauthenticated user with access to the server's socket can send
whitespace that triggers this assertion failure. We recommend that
production versions of dbus, for example in OS distributions, should be
compiled with checks but without assertions.

[smcv: expanded commit message]

Thanks: Evgeny Vereshchagin
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/421

dbus/dbus-string.c

index b3826fe1e9061b206bce9c68b0f40f632616b313..29210de7d4d0b70bd161489f899be001828bf17f 100644 (file)
@@ -1880,7 +1880,7 @@ _dbus_string_skip_blank (const DBusString *str,
       ++i;
     }
 
-  _dbus_assert (i == real->len || !DBUS_IS_ASCII_WHITE (real->str[i]));
+  _dbus_assert (i == real->len || !DBUS_IS_ASCII_BLANK (real->str[i]));
   
   if (end)
     *end = i;