From 82f74aa895d25440ebc323842c4fa6c6601fb930 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 15 Jan 2016 20:08:34 +0100 Subject: [PATCH] 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 --- dbus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbus.c b/dbus.c index c0e0cf6a..d6323ace 100644 --- a/dbus.c +++ b/dbus.c @@ -319,8 +319,9 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter) case dbustype: \ { \ const char *s = lua_tostring(L, idx + 1); \ - if(s) \ - dbus_message_iter_append_basic(iter, dbustype, &s); \ + if(!s) \ + s = ""; \ + dbus_message_iter_append_basic(iter, dbustype, &s); \ } \ break; DBUS_MSG_RETURN_HANDLE_TYPE_STRING(DBUS_TYPE_STRING)