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



commit d227c8fbf2ca9fac93dbdaf9aab635be2713109f
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 61aafbc..f2ee3f1 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -243,6 +243,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
@@ -304,6 +312,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]