From 17647403aa1fc12b042089d8d08d1f60fd470437 Mon Sep 17 00:00:00 2001 From: scottmk Date: Sat, 2 May 2009 19:54:59 +0000 Subject: [PATCH] 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 --- Open-ILS/src/c-apps/oils_cstore.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index 13fde5b48a..dfb9068017 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); -- 2.11.0