summaryrefslogtreecommitdiffstats
path: root/gdbus
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-04-07 22:07:41 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-04-09 16:59:08 +0200
commit97abe1751d5351b09bf181f59e3207ea37dcdafe (patch)
treea846f2a49f24e012ae858288f36d8118a4d2877d /gdbus
parent2f75b13ecd9e5711c9c26776e394d655e8ba72fe (diff)
downloadofono-97abe1751d5351b09bf181f59e3207ea37dcdafe.tar.bz2
gdbus: Fix crash in g_dbus_create_error_valist
Passing NULL format parameter to vsnprintf results in invalid argument error on glibc. But with some other libc libraries (musl and uClibc) this results in dereferencing NULL pointer and crash due to segmentation fault.
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/object.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index 0f42dadf..96db5166 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1412,7 +1412,10 @@ DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
{
char str[1024];
- vsnprintf(str, sizeof(str), format, args);
+ if (format)
+ vsnprintf(str, sizeof(str), format, args);
+ else
+ str[0] = '\0';
return dbus_message_new_error(message, name, str);
}