added additional sanity check to index call
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 13 Feb 2006 15:15:05 +0000 (15:15 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 13 Feb 2006 15:15:05 +0000 (15:15 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@637 9efc2488-bf62-4759-914b-345cdb29e865

src/objson/object.c

index fdd2c58..5d73642 100644 (file)
@@ -345,7 +345,8 @@ void jsonObjectNodeFree( jsonObjectNode* node ) {
 
 jsonObject* jsonObjectGetIndex( const jsonObject* obj, unsigned long index ) {
 
-       if( obj && index >= 0 && obj->type == JSON_ARRAY ) {
+       if( obj && index >= 0 && 
+                       index < obj->size && obj->type == JSON_ARRAY ) {
 
                jsonObjectNode* node = obj->value.c;
                while(node) {