summaryrefslogtreecommitdiff
path: root/src/sp_crypt.c
diff options
context:
space:
mode:
authorChristian Göttsche2024-05-29 20:38:23 +0200
committerjvoisin2024-06-06 16:27:35 +0200
commitf40955e03cd361966f927acfaa477cfceb8930e5 (patch)
treebe4213dd027ea2a8f0784068c5c84e2b5fd837ef /src/sp_crypt.c
parentd82ab8d20191a9ebdb83f918c62fc6c32f068b01 (diff)
Avoid dropping const qualifier in casts
Adjusts casts to void dropping const qualifiers. This helps to avoid mistakes, e.g. modifying string literals. Also use size_t for length, similar to the upstream php interfaces.
Diffstat (limited to 'src/sp_crypt.c')
-rw-r--r--src/sp_crypt.c4
1 files changed, 2 insertions, 2 deletions
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' "