diff --git a/apache2/libinjection/libinjection_sqli.c b/apache2/libinjection/libinjection_sqli.c
index 4807398..ccd0582 100644
--- a/apache2/libinjection/libinjection_sqli.c
+++ b/apache2/libinjection/libinjection_sqli.c
@@ -127,11 +127,12 @@ memchr2(const char *haystack, size_t haystack_len, char c0, char c1)
static const char *
my_memmem(const char* haystack, size_t hlen, const char* needle, size_t nlen)
{
+ const char* cur;
+ const char* last;
assert(haystack);
assert(needle);
assert(nlen > 1);
- const char* cur;
- const char* last = haystack + hlen - nlen;
+ last = haystack + hlen - nlen;
for (cur = haystack; cur <= last; ++cur) {
if (cur[0] == needle[0] && memcmp(cur, needle, nlen) == 0) {
return cur;
@@ -492,6 +493,7 @@ static size_t parse_slash(struct libinjection_sqli_state * sf)
const char* cur = cs + pos;
char ctype = TYPE_COMMENT;
size_t pos1 = pos + 1;
+ const char* ptr;
if (pos1 == slen || cs[pos1] != '*') {
return parse_operator1(sf);
}
@@ -499,7 +501,7 @@ static size_t parse_slash(struct libinjection_sqli_state * sf)
/*
* skip over initial '/x'
*/
- const char* ptr = memchr2(cur + 2, slen - (pos + 2), '*', '/');
+ ptr = memchr2(cur + 2, slen - (pos + 2), '*', '/');
/*
* (ptr == NULL) causes false positive in cppcheck 1.61
@@ -1286,7 +1288,7 @@ void libinjection_sqli_init(struct libinjection_sqli_state * sf, const char *s,
void libinjection_sqli_reset(struct libinjection_sqli_state * sf, int flags)
{
- ptr_lookup_fn lookup = sf->lookup;;
+ ptr_lookup_fn lookup = sf->lookup;
void *userdata = sf->userdata;
if (flags == 0) {
@@ -1936,6 +1938,7 @@ int libinjection_sqli_blacklist(struct libinjection_sqli_state* sql_state)
char ch;
size_t i;
size_t len = strlen(sql_state->fingerprint);
+ int patmatch;
if (len < 1) {
sql_state->reason = __LINE__;
@@ -1959,7 +1962,7 @@ int libinjection_sqli_blacklist(struct libinjection_sqli_state* sql_state)
}
fp2[i+1] = '\0';
- int patmatch = is_keyword(fp2, len + 1) == TYPE_FINGERPRINT;
+ patmatch = is_keyword(fp2, len + 1) == TYPE_FINGERPRINT;
/*
* No match.
diff --git a/apache2/re_operators.c b/apache2/re_operators.c
index f9ef225..ef51207 100644
--- a/apache2/re_operators.c
+++ b/apache2/re_operators.c
@@ -165,6 +165,7 @@ static int msre_op_ipmatchFromFile_param_init(msre_rule *rule, char **error_msg)
char *fn;
const char *ipfile_path;
TreeRoot *rtree = NULL;
+ int res;
if ((rule->op_param == NULL) || (strlen(rule->op_param) == 0))
{
@@ -192,7 +193,7 @@ static int msre_op_ipmatchFromFile_param_init(msre_rule *rule, char **error_msg)
apr_filepath_merge(&fn, ipfile_path, fn, APR_FILEPATH_TRUENAME, rule->ruleset->mp);
}
- int res = ip_tree_from_file(&rtree, fn, rule->ruleset->mp, error_msg);
+ res = ip_tree_from_file(&rtree, fn, rule->ruleset->mp, error_msg);
if (res)
{
return 0; |