From: miker Date: Thu, 23 Dec 2010 01:43:43 +0000 (+0000) Subject: Patch from Nathanael Schilling protecting cstore/pcrud from no-search-param segfaults... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=181d188355d9c850b824bf292f1cdb086979973b;p=evergreen%2Fbjwebb.git Patch from Nathanael Schilling protecting cstore/pcrud from no-search-param segfaults (with minor editorializing) git-svn-id: svn://svn.open-ils.org/ILS/trunk@19047 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c index c530ea654..bab3d043b 100644 --- a/Open-ILS/src/c-apps/oils_sql.c +++ b/Open-ILS/src/c-apps/oils_sql.c @@ -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" );