From: Szymon Janc Date: Tue, 7 Apr 2015 20:07:41 +0000 (+0200) Subject: gdbus: Fix crash in g_dbus_create_error_valist X-Git-Tag: upstream/1.17~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97abe1751d5351b09bf181f59e3207ea37dcdafe;p=platform%2Fupstream%2Fofono.git 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. --- 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); }