[open-ils-commits] r19048 - branches/rel_2_0/Open-ILS/src/c-apps (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 22 20:44:26 EST 2010


Author: miker
Date: 2010-12-22 20:44:25 -0500 (Wed, 22 Dec 2010)
New Revision: 19048

Modified:
   branches/rel_2_0/Open-ILS/src/c-apps/oils_sql.c
Log:
Patch from Nathanael Schilling protecting cstore/pcrud from no-search-param segfaults (with minor editorializing)

Modified: branches/rel_2_0/Open-ILS/src/c-apps/oils_sql.c
===================================================================
--- branches/rel_2_0/Open-ILS/src/c-apps/oils_sql.c	2010-12-23 01:43:43 UTC (rev 19047)
+++ branches/rel_2_0/Open-ILS/src/c-apps/oils_sql.c	2010-12-23 01:44:25 UTC (rev 19048)
@@ -1183,6 +1183,11 @@
 		rest_of_query = jsonObjectGetIndex( ctx->params, 1 );
 	}
 
+	if( !where_clause ) { 
+		osrfLogError( OSRF_LOG_MARK, "No WHERE clause parameter supplied" );
+		return -1;
+	}
+
 	// Get the class metadata
 	osrfHash* method_meta = (osrfHash*) ctx->method->userData;
 	osrfHash* class_meta = osrfHashGet( method_meta, "class" );
@@ -1249,6 +1254,11 @@
 		rest_of_query = jsonObjectClone( jsonObjectGetIndex( ctx->params, 1 ) );
 	}
 
+	if( !where_clause ) { 
+		osrfLogError( OSRF_LOG_MARK, "No WHERE clause parameter supplied" );
+		return -1;
+	}
+
 	// Eliminate certain SQL clauses, if present.
 	if( rest_of_query ) {
 		jsonObjectRemoveKey( rest_of_query, "select" );



More information about the open-ils-commits mailing list