diff options
author | Chengwei Yang <chengwei.yang@intel.com> | 2013-06-06 13:25:10 +0800 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-06-12 13:42:00 +0100 |
commit | 16f3b1246c134a4ed72779ce248902e9b03d38f6 (patch) | |
tree | 4bf0c2adfc6b527feda399915e4b341f650095b8 | |
parent | 634dc5d8a02c4de31c146e845e908f01d803d411 (diff) | |
download | dbus-16f3b1246c134a4ed72779ce248902e9b03d38f6.tar.gz |
Fix dbus-daemon crash due to invalid service file
dbus-daemon will crash due to invalid service file which key/value
starts before section. In that situation, new_line() will try to access
invalid address.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60853
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | bus/desktop-file.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bus/desktop-file.c b/bus/desktop-file.c index ae441c5e..bfeb72e2 100644 --- a/bus/desktop-file.c +++ b/bus/desktop-file.c @@ -688,6 +688,12 @@ bus_desktop_file_load (DBusString *filename, else if (is_blank_line (&parser) || _dbus_string_get_byte (&parser.data, parser.pos) == '#') parse_comment_or_blank (&parser); + else if (parser.current_section < 0) + { + dbus_set_error(error, DBUS_ERROR_FAILED, + "invalid service file: key=value before [Section]"); + return NULL; + } else { if (!parse_key_value (&parser, error)) |