DBusConnection: Validate the path sent to the _Introspect() method, to replace a crash by an error or a void result.

[GB.DBUS]
* BUG: DBusConnection: Validate the path sent to the _Introspect() method, to replace a crash by an error or a void result.
This commit is contained in:
gambas 2020-11-24 21:47:29 +01:00
parent 1bf591abe6
commit 48f84df846
3 changed files with 14 additions and 2 deletions

View file

@ -102,6 +102,12 @@ BEGIN_METHOD(DBusConnection_Introspect, GB_STRING application; GB_STRING object)
else
object = "/";
if (DBUS_validate_path(object, LENGTH(object)))
{
GB.Error("Invalid object path");
return;
}
GB.ReturnNewZeroString(DBUS_introspect(THIS->connection, application, object));
END_METHOD

View file

@ -1,7 +1,7 @@
# Gambas Project File 3.0
Title=gb.dbus
Startup=MMain
Version=3.14.90
Version=3.15.90
VersionFile=1
Component=gb.dbus
TabSize=2

View file

@ -139,7 +139,7 @@ Public Sub Main1()
End
Public Sub Main()
Public Sub Main4()
Dim hDBusApplication As DBusApplication
Dim hDBusProxy As DBusProxy
@ -152,3 +152,9 @@ Public Sub Main()
Print hDBusProxy.State() 'Should be invalid
End
Public Sub Main()
Print DBus["org.freedesktop.DBus"]._Introspect("/a")
End