Commit 8eb29fda authored by Chengwei Yang's avatar Chengwei Yang Committed by Simon McVittie
Browse files

DBusString: fix may crash if try to free an uninitialized str

If the str will be freed hasn't been initialized by _dbus_string_init
correctly, _dbus_string_free may crash due to trying to free an
undefined memory.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65959

Signed-off-by: default avatarChengwei Yang <chengwei.yang@intel.com>
Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent ba0f90c1
......@@ -246,6 +246,14 @@ _dbus_string_free (DBusString *str)
if (real->constant)
return;
/* so it's safe if @p str returned by a failed
* _dbus_string_init call
* Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65959
*/
if (real->str == NULL)
return;
dbus_free (real->str - real->align_offset);
real->invalid = TRUE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment