a_dbus_convert_value(): Be less strict about wrong strings

The code doesn't check the type of any of the values that it converts. However,
string elements are silently skipped if they cannot be converted.

The proper fix would be to make this code check types. For now, it will be ok to
"convert" non-strings to an empty string.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-01-15 20:08:34 +01:00
parent 8b3087dc4e
commit 82f74aa895

5
dbus.c
View file

@ -319,8 +319,9 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter)
case dbustype: \ case dbustype: \
{ \ { \
const char *s = lua_tostring(L, idx + 1); \ const char *s = lua_tostring(L, idx + 1); \
if(s) \ if(!s) \
dbus_message_iter_append_basic(iter, dbustype, &s); \ s = ""; \
dbus_message_iter_append_basic(iter, dbustype, &s); \
} \ } \
break; break;
DBUS_MSG_RETURN_HANDLE_TYPE_STRING(DBUS_TYPE_STRING) DBUS_MSG_RETURN_HANDLE_TYPE_STRING(DBUS_TYPE_STRING)