mirror of
https://github.com/sailfishos/ofono
synced 2025-11-27 21:12:35 +08:00
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.
This commit is contained in:
committed by
Slava Monich
parent
11d6e76f0a
commit
4bae61c83e
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user