From: scottmk Date: Sat, 2 May 2009 19:54:59 +0000 (+0000) Subject: Detect and report certain malformations in the ORDER BY clause X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=17647403aa1fc12b042089d8d08d1f60fd470437;p=evergreen%2Fbjwebb.git Detect and report certain malformations in the ORDER BY clause (which would otherwise cause segfaults). git-svn-id: svn://svn.open-ils.org/ILS/trunk@13037 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index 13fde5b48..dfb906801 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -3634,6 +3634,28 @@ char* SELECT ( } } + } else if ( JSON_NULL == onode->type || JSON_ARRAY == onode->type ) { + osrfLogError( OSRF_LOG_MARK, + "%s: Expected JSON_STRING in ORDER BY clause; found %s", + MODULENAME, json_type( onode->type ) ); + if( ctx ) + osrfAppSessionStatus( + ctx->session, + OSRF_STATUS_INTERNALSERVERERROR, + "osrfMethodException", + ctx->request, + "Malformed ORDER BY clause -- see error log for more details" + ); + jsonIteratorFree( order_itr ); + jsonIteratorFree( class_itr ); + free(core_class); + buffer_free(having_buf); + buffer_free(group_buf); + buffer_free(order_buf); + buffer_free(sql_buf); + if (defaultselhash) jsonObjectFree(defaultselhash); + return NULL; + } else { string = strdup(order_itr->key); const char* dir = jsonObjectGetString(onode);