[tracker] TrackerDBInterfaceSqlite: do sanity check on is_parent() and is_descendant().



commit f298c46e91f37b0b5b653e27e8bfa941d608a149
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 22 13:35:21 2010 +0200

    TrackerDBInterfaceSqlite: do sanity check on is_parent() and is_descendant().

 src/libtracker-db/tracker-db-interface-sqlite.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 95ee2d3..8f9f014 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -245,6 +245,14 @@ function_sparql_uri_is_parent (sqlite3_context *context,
 		return;
 	}
 
+	/* Check only one argument, it's going to
+	 * be compared with the other anyway.
+	 */
+	if (strstr (parent, "://") == NULL) {
+		sqlite3_result_int (context, FALSE);
+		return;
+	}
+
 	parent_len = strlen (parent);
 
 	/* Remove trailing '/', will
@@ -306,6 +314,14 @@ function_sparql_uri_is_descendant (sqlite3_context *context,
 		return;
 	}
 
+	/* Check only one argument, it's going to
+	 * be compared with the other anyway.
+	 */
+	if (strstr (parent, "://") == NULL) {
+		sqlite3_result_int (context, FALSE);
+		return;
+	}
+
 	parent_len = strlen (parent);
 
 	/* Remove trailing '/', will



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