dbus.c: Check string return values properly
Apparently some versions of dbus kill the process with a failed assertion if invalid UTF8 should be send out. Mine doesn't. Also, our behaviour of replacing non-strings silently with strings is weird. This commit thus makes converting from Lua to dbus fail if a non-string should be sent as a string or if a string contains malformed UTF8. Fixes: https://github.com/awesomeWM/awesome/issues/728 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
77507a2877
commit
7f43608d73
6
dbus.c
6
dbus.c
|
@ -318,8 +318,10 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter)
|
|||
case DBUS_TYPE_STRING:
|
||||
{
|
||||
const char *s = lua_tostring(L, idx + 1);
|
||||
if(!s)
|
||||
s = "";
|
||||
if(!s || !dbus_validate_utf8(s, NULL)) {
|
||||
luaA_warn(L, "Your D-Bus signal handling method returned an invalid string");
|
||||
return false;
|
||||
}
|
||||
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &s);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue