[open-ils-commits] r13037 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat May 2 15:55:03 EDT 2009


Author: scottmk
Date: 2009-05-02 15:54:59 -0400 (Sat, 02 May 2009)
New Revision: 13037

Modified:
   trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
Detect and report certain malformations in the ORDER BY clause
(which would otherwise cause segfaults).


Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-05-02 19:27:02 UTC (rev 13036)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-05-02 19:54:59 UTC (rev 13037)
@@ -3634,6 +3634,28 @@
 								}
 							}
 
+						} 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);



More information about the open-ils-commits mailing list