[tracker/tracker-0.8] tracker-extract, msoffice-xml: Avoid possible NULL dereference



commit 88b6de7824427ba01988ec504aa35763e8ab0efc
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Mon Jul 12 14:06:38 2010 +0200

    tracker-extract, msoffice-xml: Avoid possible NULL dereference

 src/tracker-extract/tracker-extract-msoffice.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index 3e0c1ac..7ba6709 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -2195,6 +2195,14 @@ xml_start_element_handler_content_types (GMarkupParseContext  *context,
 		}
 	}
 
+	/* Both part_name and content_type MUST be NON-NULL */
+	if (!part_name || !content_type) {
+		g_message ("Invalid file (part_name:%s, content_type:%s)",
+		           part_name ? part_name : "none",
+		           content_type ? content_type : "none");
+		return;
+	}
+
 	if ((g_ascii_strcasecmp (content_type, "application/vnd.openxmlformats-package.core-properties+xml") == 0) ||
 	    (g_ascii_strcasecmp (content_type, "application/vnd.openxmlformats-officedocument.extended-properties+xml") == 0)) {
 		xml_read (info, part_name + 1, MS_OFFICE_XML_TAG_DOCUMENT_CORE_DATA);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]