diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2015-04-07 22:07:41 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-04-09 16:58:51 +0200 |
commit | f928b9f55bdcc66331b2bf9ef98116aef8b12e4b (patch) | |
tree | 799a7f2806128a19f121ed52b73ea415172215e5 | |
parent | 380fb591e6b41370a1084cb7ee0aa5baf1a13d58 (diff) | |
download | pacrunner-f928b9f55bdcc66331b2bf9ef98116aef8b12e4b.tar.gz |
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.
-rw-r--r-- | gdbus/object.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdbus/object.c b/gdbus/object.c index 0f42dad..96db516 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); } |