Patch from Nathanael Schilling protecting cstore/pcrud from no-search-param segfaults...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Dec 2010 01:43:43 +0000 (01:43 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Dec 2010 01:43:43 +0000 (01:43 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19047 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_sql.c

index c530ea6..bab3d04 100644 (file)
@@ -1183,6 +1183,11 @@ int doSearch( osrfMethodContext* ctx ) {
                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 @@ int doIdList( osrfMethodContext* ctx ) {
                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" );