GNOME Bugzilla – Bug 768441
wrong calculation of space allocated for new_argv in require_dbus_session() leads to heap overflow
Last modified: 2016-07-11 14:40:57 UTC
Created attachment 330900 [details] [review] patch to fix heap overflow I have discovered a heap overflow in gnome-session with the help of address sanitizer. This is the code (main.c, function require_dbus_session): new_argv = g_malloc (argc + 3 * sizeof (*argv)); The intention is to allocate space for (argc + 3) pointers. However obviously a bracket is missing, therefore only argc bytes + 3 * pointer size gets allocated, which will be to small. Later on this leads to invalid memory writes. The fix is trivial: Bracket around argc + 3. See attached patch. Affects current git code.
Thanks pushed attachment 330900 [details] [review] as commit e430239df