summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sp_config.h2
-rw-r--r--src/sp_config_scanner.h4
-rw-r--r--src/sp_config_scanner.re10
-rw-r--r--src/sp_cookie_encryption.c2
-rw-r--r--src/sp_crypt.c4
-rw-r--r--src/sp_ifilter.c4
-rw-r--r--src/sp_utils.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/src/sp_config.h b/src/sp_config.h
index f957d15..f245943 100644
--- a/src/sp_config.h
+++ b/src/sp_config.h
@@ -188,7 +188,7 @@ typedef struct {
188 188
189typedef struct { 189typedef struct {
190 SP_PARSE_FN((*func)); 190 SP_PARSE_FN((*func));
191 char *token; 191 const char *token;
192 void *retval; 192 void *retval;
193} sp_config_keyword; 193} sp_config_keyword;
194 194
diff --git a/src/sp_config_scanner.h b/src/sp_config_scanner.h
index 71f8f7e..560ea6e 100644
--- a/src/sp_config_scanner.h
+++ b/src/sp_config_scanner.h
@@ -10,9 +10,9 @@ typedef enum {
10} sp_argtype; 10} sp_argtype;
11 11
12typedef struct { 12typedef struct {
13 char *kw; // keyword points directly to the parsed input text and as such is not null-terminated 13 const char *kw; // keyword points directly to the parsed input text and as such is not null-terminated
14 size_t kwlen; 14 size_t kwlen;
15 char *arg; // optional argument / can be not null terminated 15 const char *arg; // optional argument / can be not null terminated
16 size_t arglen; 16 size_t arglen;
17 sp_argtype argtype; 17 sp_argtype argtype;
18 long lineno; 18 long lineno;
diff --git a/src/sp_config_scanner.re b/src/sp_config_scanner.re
index 82359d6..8f0b24e 100644
--- a/src/sp_config_scanner.re
+++ b/src/sp_config_scanner.re
@@ -197,8 +197,8 @@ zend_result sp_config_scan(const char *data, zend_result (*process_rule)(sp_pars
197 <init> end { ret = SUCCESS; goto out; } 197 <init> end { ret = SUCCESS; goto out; }
198 <init> "@"? "set" whitespace+ @t1 keyword @t2 whitespace+ @t3 string @t4 whitespace* ";" { 198 <init> "@"? "set" whitespace+ @t1 keyword @t2 whitespace+ @t3 string @t4 whitespace* ";" {
199 if (!cond_res[0]) { goto yyc_init; } 199 if (!cond_res[0]) { goto yyc_init; }
200 char *key = (char*)t1; 200 const char *key = t1;
201 int keylen = t2 - t1; 201 size_t keylen = t2 - t1;
202 zend_string *tmp = zend_hash_str_find_ptr(&vars, key, keylen); 202 zend_string *tmp = zend_hash_str_find_ptr(&vars, key, keylen);
203 if (tmp) { 203 if (tmp) {
204 zend_hash_str_del(&vars, key, keylen); 204 zend_hash_str_del(&vars, key, keylen);
@@ -304,9 +304,9 @@ zend_result sp_config_scan(const char *data, zend_result (*process_rule)(sp_pars
304 goto out; 304 goto out;
305 } 305 }
306 sp_parsed_keyword kw = { 306 sp_parsed_keyword kw = {
307 .kw = (char*)t1, 307 .kw = t1,
308 .kwlen = t2-t1, 308 .kwlen = t2-t1,
309 .arg = (char*)t3, 309 .arg = t3,
310 .arglen = t4-t3, 310 .arglen = t4-t3,
311 .argtype = SP_ARGTYPE_UNKNOWN, 311 .argtype = SP_ARGTYPE_UNKNOWN,
312 .lineno = lineno 312 .lineno = lineno
@@ -315,7 +315,7 @@ zend_result sp_config_scan(const char *data, zend_result (*process_rule)(sp_pars
315 if (t3 == t4) { 315 if (t3 == t4) {
316 kw.argtype = SP_ARGTYPE_EMPTY; 316 kw.argtype = SP_ARGTYPE_EMPTY;
317 } else if (t4-t3 >= 2 && *t3 == '"') { 317 } else if (t4-t3 >= 2 && *t3 == '"') {
318 kw.arg = (char*)t3 + 1; 318 kw.arg = t3 + 1;
319 kw.arglen = t4 - t3 - 2; 319 kw.arglen = t4 - t3 - 2;
320 kw.argtype = SP_ARGTYPE_STR; 320 kw.argtype = SP_ARGTYPE_STR;
321 } else { 321 } else {
diff --git a/src/sp_cookie_encryption.c b/src/sp_cookie_encryption.c
index b2cff66..8b24a9c 100644
--- a/src/sp_cookie_encryption.c
+++ b/src/sp_cookie_encryption.c
@@ -98,7 +98,7 @@ PHP_FUNCTION(sp_setcookie) {
98 zval *expires_or_options = NULL; 98 zval *expires_or_options = NULL;
99 zend_bool secure = 0, httponly = 0; 99 zend_bool secure = 0, httponly = 0;
100 const sp_cookie *cookie_node = NULL; 100 const sp_cookie *cookie_node = NULL;
101 char *cookie_samesite; 101 const char *cookie_samesite;
102 102
103 // LCOV_EXCL_BR_START 103 // LCOV_EXCL_BR_START
104 ZEND_PARSE_PARAMETERS_START(1, 7) 104 ZEND_PARSE_PARAMETERS_START(1, 7)
diff --git a/src/sp_crypt.c b/src/sp_crypt.c
index a27cc67..6d48554 100644
--- a/src/sp_crypt.c
+++ b/src/sp_crypt.c
@@ -14,11 +14,11 @@ void generate_key(unsigned char *key) {
14 PHP_SHA256Init(&ctx); 14 PHP_SHA256Init(&ctx);
15 15
16 if (user_agent) { 16 if (user_agent) {
17 PHP_SHA256Update(&ctx, (unsigned char *)user_agent, strlen(user_agent)); 17 PHP_SHA256Update(&ctx, (const unsigned char *)user_agent, strlen(user_agent));
18 } 18 }
19 19
20 if (env_var) { 20 if (env_var) {
21 PHP_SHA256Update(&ctx, (unsigned char *)env_var, strlen(env_var)); 21 PHP_SHA256Update(&ctx, (const unsigned char *)env_var, strlen(env_var));
22 } else { 22 } else {
23 sp_log_warn("cookie_encryption", 23 sp_log_warn("cookie_encryption",
24 "The environment variable '%s' " 24 "The environment variable '%s' "
diff --git a/src/sp_ifilter.c b/src/sp_ifilter.c
index 9c46875..67eb5f3 100644
--- a/src/sp_ifilter.c
+++ b/src/sp_ifilter.c
@@ -24,7 +24,7 @@ static const char sp_is_dangerous_char[256] = {
24/* 0xf0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 24/* 0xf0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
25}; 25};
26 26
27static void sp_server_strip(HashTable *svars, char *key, int keylen) { 27static void sp_server_strip(HashTable *svars, const char *key, size_t keylen) {
28 zval *value = zend_hash_str_find(svars, key, keylen); 28 zval *value = zend_hash_str_find(svars, key, keylen);
29 if (!value || Z_TYPE_P(value) != IS_STRING) { return; } 29 if (!value || Z_TYPE_P(value) != IS_STRING) { return; }
30 30
@@ -39,7 +39,7 @@ static void sp_server_strip(HashTable *svars, char *key, int keylen) {
39 } 39 }
40} 40}
41 41
42static void sp_server_encode(HashTable *svars, char *key, int keylen) { 42static void sp_server_encode(HashTable *svars, const char *key, size_t keylen) {
43 zval *value = zend_hash_str_find(svars, key, keylen); 43 zval *value = zend_hash_str_find(svars, key, keylen);
44 if (!value || Z_TYPE_P(value) != IS_STRING) { return; } 44 if (!value || Z_TYPE_P(value) != IS_STRING) { return; }
45 45
diff --git a/src/sp_utils.h b/src/sp_utils.h
index 7bab4ba..36caa52 100644
--- a/src/sp_utils.h
+++ b/src/sp_utils.h
@@ -84,7 +84,7 @@ void unhook_functions(HashTable *ht);
84int hook_regexp(const sp_pcre *, HashTable *, zif_handler); 84int hook_regexp(const sp_pcre *, HashTable *, zif_handler);
85bool check_is_in_eval_whitelist(const char* function_name); 85bool check_is_in_eval_whitelist(const char* function_name);
86int sp_log_request(zend_string const* const restrict folder, zend_string const* const restrict text_repr); 86int sp_log_request(zend_string const* const restrict folder, zend_string const* const restrict text_repr);
87#define sp_zend_string_equals(s1, s2) zend_string_equals((zend_string*)s1, (zend_string*)s2) 87#define sp_zend_string_equals(s1, s2) zend_string_equals((const zend_string*)s1, (const zend_string*)s2)
88static inline bool sp_zend_string_equals_str(const zend_string* s1, const char *str, size_t len) { 88static inline bool sp_zend_string_equals_str(const zend_string* s1, const char *str, size_t len) {
89 return (ZSTR_LEN(s1) == len && !memcmp(ZSTR_VAL(s1), str, len)); 89 return (ZSTR_LEN(s1) == len && !memcmp(ZSTR_VAL(s1), str, len));
90} 90}