Permalink
Browse files

fix gcc8 warnings

  • Loading branch information...
buixor committed Nov 23, 2018
1 parent d9bfac6 commit 097a1e9fae06ac28c4828cb02940090127e253f8
Showing with 11 additions and 6 deletions.
  1. +2 −2 naxsi_src/naxsi_runtime.c
  2. +5 −0 naxsi_src/naxsi_skeleton.c
  3. +4 −4 naxsi_src/naxsi_utils.c
@@ -733,10 +733,10 @@ ngx_http_dummy_is_rule_whitelisted_n(ngx_http_request_t *req,
tmp_hashname.data = ngx_pcalloc(req->pool, tmp_hashname.len+2);
if (target_name) {
tmp_hashname.len++;
strncat((char*)tmp_hashname.data, "#", 1);
strcat((char*)tmp_hashname.data, "#");
}
strncat((char*) tmp_hashname.data, (char*)req->uri.data, req->uri.len);
strncat((char*)tmp_hashname.data, "#", 1);
strcat((char*)tmp_hashname.data, "#");
strncat((char*)tmp_hashname.data, (char*)name->data, name->len);
NX_DEBUG(_debug_whitelist_compat, NGX_LOG_DEBUG_HTTP, req->connection->log, 0, "hashing MIX [%V] ($URL:x|$X_VAR:y) or ($URL:x|$X_VAR:y|NAME)", &tmp_hashname);
@@ -414,8 +414,13 @@ ngx_http_dummy_init(ngx_conf_t *cf)
libjct_sql->sc_tag->data = ngx_pcalloc(cf->pool, 18 /* LIBINJECTION_SQL */);
libjct_xss->sc_tag->data = ngx_pcalloc(cf->pool, 18 /* LIBINJECTION_XSS */);
if (!libjct_sql->sc_tag->data || !libjct_xss->sc_tag->data) return (NGX_ERROR); /* LCOV_EXCL_LINE */
/* avoid stringop-truncation false positive.
nginx_str_t is not null terminated */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy((char *)libjct_sql->sc_tag->data, (char *)"$LIBINJECTION_SQL", 17);
strncpy((char *)libjct_xss->sc_tag->data, (char *)"$LIBINJECTION_XSS", 17);
#pragma GCC diagnostic pop
libjct_xss->sc_tag->len = 17;
libjct_sql->sc_tag->len = 17;
libjct_sql->sc_score = 8;
@@ -455,11 +455,11 @@ ngx_http_wlr_find(ngx_conf_t *cf, ngx_http_dummy_loc_conf_t *dlc,
"whitelist targets |NAME");
strncat(*fullname, (const char *) "#", 1);
strcat(*fullname, (const char *) "#");
}
strncat(*fullname, (const char *) custloc_array(curr->br->custom_locations->elts)[uri_idx].target.data,
custloc_array(curr->br->custom_locations->elts)[uri_idx].target.len);
strncat(*fullname, (const char *) "#", 1);
strcat(*fullname, (const char *) "#");
strncat(*fullname, (const char *) custloc_array(curr->br->custom_locations->elts)[name_idx].target.data,
custloc_array(curr->br->custom_locations->elts)[name_idx].target.len);
}
@@ -477,7 +477,7 @@ ngx_http_wlr_find(ngx_conf_t *cf, ngx_http_dummy_loc_conf_t *dlc,
"whitelist targets |NAME");
strncat(*fullname, (const char *) "#", 1);
strcat(*fullname, (const char *) "#");
}
@@ -492,7 +492,7 @@ ngx_http_wlr_find(ngx_conf_t *cf, ngx_http_dummy_loc_conf_t *dlc,
*fullname = ngx_pcalloc(cf->pool, custloc_array(curr->br->custom_locations->elts)[name_idx].target.len + 2);
if (curr->br->target_name)
strncat(*fullname, (const char *) "#", 1);
strcat(*fullname, (const char *) "#");
strncat(*fullname, (const char *) custloc_array(curr->br->custom_locations->elts)[name_idx].target.data,
custloc_array(curr->br->custom_locations->elts)[name_idx].target.len);
}

0 comments on commit 097a1e9

Please sign in to comment.