[tracker/tracker-0.10] libtracker-extract: Don't assume ':' exists in every path we iterate



commit ddc98e8ada1a6e127dbbf1d4777c0c3cd7b64fc3
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Sep 6 15:04:37 2011 +0100

    libtracker-extract: Don't assume ':' exists in every path we iterate
    
    This makes sure we don't accidentally return g_strdup(NULL + 1) when iterating
    XMP data

 src/libtracker-extract/tracker-xmp.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index dbb2b99..c5ba856 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -350,11 +350,16 @@ iterate_simple (const gchar    *uri,
 	const gchar *p;
 	gchar *propname;
 
-	name = g_strdup (strchr (path, ':') + 1);
+	p = strchr (path, ':');
+	if (!p) {
+		return;
+	}
 
-        /* For 'dc:subject[1]' the name will be 'subject'.
-         * This rule doesn't work for RegionLists
-         */
+	name = g_strdup (p + 1);
+
+	/* For 'dc:subject[1]' the name will be 'subject'.
+	 * This rule doesn't work for RegionLists
+	 */
 	p = strrchr (name, '[');
 	if (p) {
 		name[p - name] = '\0';



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