@@ -81,7 +81,7 @@ static ngx_command_t ngx_http_modsecurity_commands[] = {
8181 |NGX_HTTP_LOC_CONF |NGX_HTTP_LIF_CONF |NGX_CONF_TAKE1 ,
8282 ngx_http_modsecurity_enable ,
8383 NGX_HTTP_LOC_CONF_OFFSET ,
84- offsetof(ngx_http_modsecurity_loc_conf_t , enable ),
84+ offsetof(ngx_http_modsecurity_loc_conf_t , enable ), // cppcheck-suppress syntaxError
8585 NULL },
8686 ngx_null_command
8787};
@@ -210,9 +210,9 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r)
210210 size_t root ;
211211 ngx_str_t path ;
212212 ngx_uint_t port ;
213- struct sockaddr_in * sin ;
213+ const struct sockaddr_in * sin ;
214214#if (NGX_HAVE_INET6 )
215- struct sockaddr_in6 * sin6 ;
215+ const struct sockaddr_in6 * sin6 ;
216216#endif
217217
218218 ctx = ngx_http_get_module_ctx (r , ngx_http_modsecurity );
@@ -616,11 +616,9 @@ ngx_http_modsecurity_load_headers_out(ngx_http_request_t *r)
616616 ngx_http_modsecurity_ctx_t * ctx ;
617617 char * data ;
618618 request_rec * req ;
619- ngx_http_variable_value_t * vv ;
620- ngx_list_part_t * part ;
619+ const ngx_list_part_t * part ;
621620 ngx_table_elt_t * h ;
622621 ngx_uint_t i ;
623- char * key , * value ;
624622 u_char * buf = NULL ;
625623 size_t size = 0 ;
626624
@@ -651,11 +649,11 @@ ngx_http_modsecurity_load_headers_out(ngx_http_request_t *r)
651649 return NGX_ERROR ;
652650 }
653651
654- key = (char * )buf ;
652+ char * key = (char * )buf ;
655653 buf = ngx_cpymem (buf , h [i ].key .data , h [i ].key .len );
656654 * buf ++ = '\0' ;
657655
658- value = (char * )buf ;
656+ char * value = (char * )buf ;
659657 buf = ngx_cpymem (buf , h [i ].value .data , h [i ].value .len );
660658 * buf ++ = '\0' ;
661659
@@ -668,7 +666,7 @@ ngx_http_modsecurity_load_headers_out(ngx_http_request_t *r)
668666
669667 for (i = 0 ; special_headers_out [i ].name ; i ++ ) {
670668
671- vv = ngx_http_get_variable (r , & special_headers_out [i ].variable_name ,
669+ ngx_http_variable_value_t * vv = ngx_http_get_variable (r , & special_headers_out [i ].variable_name ,
672670 ngx_hash_key (special_headers_out [i ].variable_name .data ,
673671 special_headers_out [i ].variable_name .len ));
674672
@@ -892,7 +890,7 @@ modsec_pcre_malloc(size_t size)
892890}
893891
894892static void
895- modsec_pcre_free (void * ptr )
893+ modsec_pcre_free (const void * ptr )
896894{
897895}
898896
@@ -928,7 +926,7 @@ ngx_http_modsecurity_preconfiguration(ngx_conf_t *cf)
928926
929927
930928static void
931- ngx_http_modsecurity_terminate (ngx_cycle_t * cycle )
929+ ngx_http_modsecurity_terminate (const ngx_cycle_t * cycle )
932930{
933931 if (modsec_server ) {
934932 modsecTerminate ();
@@ -981,7 +979,7 @@ ngx_http_modsecurity_init_process(ngx_cycle_t *cycle)
981979static ngx_int_t
982980ngx_http_modsecurity_handler (ngx_http_request_t * r )
983981{
984- ngx_http_modsecurity_loc_conf_t * cf ;
982+ const ngx_http_modsecurity_loc_conf_t * cf ;
985983 ngx_http_modsecurity_ctx_t * ctx ;
986984 ngx_int_t rc ;
987985
@@ -1089,11 +1087,9 @@ ngx_http_modsecurity_body_handler(ngx_http_request_t *r)
10891087
10901088static ngx_int_t
10911089ngx_http_modsecurity_header_filter (ngx_http_request_t * r ) {
1092- ngx_http_modsecurity_loc_conf_t * cf ;
1090+ const ngx_http_modsecurity_loc_conf_t * cf ;
10931091 ngx_http_modsecurity_ctx_t * ctx ;
1094- const char * location ;
1095- ngx_table_elt_t * h ;
1096-
1092+
10971093 cf = ngx_http_get_module_loc_conf (r , ngx_http_modsecurity );
10981094 ctx = ngx_http_get_module_ctx (r , ngx_http_modsecurity );
10991095
@@ -1103,13 +1099,13 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r) {
11031099 && r -> err_status < 308 ) {
11041100
11051101 /* 3XX load redirect location header so that we can do redirect in phase 3,4 */
1106- location = apr_table_get (ctx -> req -> headers_out , "Location" );
1102+ const char * location = apr_table_get (ctx -> req -> headers_out , "Location" );
11071103
11081104 if (location == NULL ) {
11091105 return NGX_HTTP_INTERNAL_SERVER_ERROR ;
11101106 }
11111107
1112- h = ngx_list_push (& r -> headers_out .headers );
1108+ ngx_table_elt_t * h = ngx_list_push (& r -> headers_out .headers );
11131109 if (h == NULL ) {
11141110 return NGX_HTTP_INTERNAL_SERVER_ERROR ;
11151111 }
@@ -1137,12 +1133,12 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r) {
11371133static ngx_int_t
11381134ngx_http_modsecurity_body_filter (ngx_http_request_t * r , ngx_chain_t * in )
11391135{
1140- ngx_http_modsecurity_loc_conf_t * cf ;
1141- ngx_http_modsecurity_ctx_t * ctx ;
1142- ngx_int_t rc ;
1143- apr_off_t content_length ;
1144- ngx_chain_t * cl , * out ;
1145- ngx_int_t last_buf = 0 ;
1136+ const ngx_http_modsecurity_loc_conf_t * cf ;
1137+ ngx_http_modsecurity_ctx_t * ctx ;
1138+ ngx_int_t rc ;
1139+ apr_off_t content_length ;
1140+ ngx_chain_t * cl , * out ;
1141+ ngx_int_t last_buf = 0 ;
11461142
11471143 cf = ngx_http_get_module_loc_conf (r , ngx_http_modsecurity );
11481144 ctx = ngx_http_get_module_ctx (r , ngx_http_modsecurity );
0 commit comments