@@ -70,7 +70,7 @@ int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
7070 * Callback for hash key values; we use those to define the variable names
7171 * under ARGS. Whenever we reach a new key, we update the current key value.
7272 */
73- static int yajl_map_key (void * ctx ,const unsignedchar * key ,unsigned int length )
73+ static int yajl_map_key (void * ctx ,const unsignedchar * key ,size_t length )
7474{
7575modsec_rec * msr = (modsec_rec * )ctx ;
7676unsignedchar * safe_key = (unsignedchar * )NULL ;
@@ -126,7 +126,7 @@ static int yajl_boolean(void *ctx, int value)
126126/**
127127 * Callback for string values
128128 */
129- static int yajl_string (void * ctx ,const unsignedchar * value ,unsigned int length )
129+ static int yajl_string (void * ctx ,const unsignedchar * value ,size_t length )
130130{
131131modsec_rec * msr = (modsec_rec * )ctx ;
132132
@@ -138,7 +138,7 @@ static int yajl_string(void *ctx, const unsigned char *value, unsigned int lengt
138138 * float/double values, but since we are not interested in using the numeric
139139 * values here, we use a generic handler which uses numeric strings
140140 */
141- static int yajl_number (void * ctx ,const unsigned char * value ,unsigned int length )
141+ static int yajl_number (void * ctx ,const char * value ,size_t length )
142142{
143143modsec_rec * msr = (modsec_rec * )ctx ;
144144
@@ -222,19 +222,18 @@ int json_init(modsec_rec *msr, char **error_msg) {
222222/**
223223 * yajl configuration and callbacks
224224 */
225- static yajl_parser_config config = {0 ,1 };
226225static yajl_callbacks callbacks = {
227226yajl_null ,
228227yajl_boolean ,
229- NULL /* yajl_integer */ ,
230- NULL /* yajl_double */ ,
228+ NULL /* yajl_integer */ ,
229+ NULL /* yajl_double */ ,
231230yajl_number ,
232231yajl_string ,
233232yajl_start_map ,
234233yajl_map_key ,
235234yajl_end_map ,
236235NULL /* yajl_start_array */ ,
237- NULL /* yajl_end_array */
236+ NULL /* yajl_end_array */
238237 };
239238
240239if (error_msg == NULL )return -1 ;
@@ -261,7 +260,7 @@ int json_init(modsec_rec *msr, char **error_msg) {
261260if (msr -> txcfg -> debuglog_level >=9 ) {
262261msr_log (msr ,9 ,"yajl JSON parsing callback initialization" );
263262 }
264- msr -> json -> handle = yajl_alloc (& callbacks ,& config , NULL ,msr );
263+ msr -> json -> handle = yajl_alloc (& callbacks ,NULL ,msr );
265264
266265return 1 ;
267266}
@@ -275,8 +274,7 @@ int json_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char
275274
276275/* Feed our parser and catch any errors */
277276msr -> json -> status = yajl_parse (msr -> json -> handle ,buf ,size );
278- if (msr -> json -> status != yajl_status_ok &&
279- msr -> json -> status != yajl_status_insufficient_data ) {
277+ if (msr -> json -> status != yajl_status_ok ) {
280278/* We need to free the yajl error message later, how to do this? */
281279* error_msg = yajl_get_error (msr -> json -> handle ,0 ,buf ,size );
282280 }
@@ -294,9 +292,8 @@ int json_complete(modsec_rec *msr, char **error_msg) {
294292* error_msg = NULL ;
295293
296294/* Wrap up the parsing process */
297- msr -> json -> status = yajl_parse_complete (msr -> json -> handle );
298- if (msr -> json -> status != yajl_status_ok &&
299- msr -> json -> status != yajl_status_insufficient_data ) {
295+ msr -> json -> status = yajl_complete_parse (msr -> json -> handle );
296+ if (msr -> json -> status != yajl_status_ok ) {
300297/* We need to free the yajl error message later, how to do this? */
301298* error_msg = yajl_get_error (msr -> json -> handle ,0 ,NULL ,0 );
302299 }