In searchJOIN(): added a bit of sanity checking, to prevent
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Feb 2009 23:19:16 +0000 (23:19 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Feb 2009 23:19:16 +0000 (23:19 +0000)
segfaults induced by certain kinds of malformed JSOn queries.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@12211 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 14ac875..9b85bd4 100644 (file)
@@ -2011,8 +2011,17 @@ static char* searchJOIN ( const jsonObject* join_hash, osrfHash* leftmeta ) {
                free(_tmp);
                working_hash = freeable_hash;
        }
-       else
+       else {
+               if( join_hash->type != JSON_HASH ) {
+                       osrfLogError(
+                               OSRF_LOG_MARK,
+                               "%s: JOIN failed; expected JSON object type not found",
+                               MODULENAME
+                       );
+                       return NULL;
+               }
                working_hash = join_hash;
+       }
 
        growing_buffer* join_buf = buffer_init(128);
        const char* leftclass = osrfHashGet(leftmeta, "classname");