Skip to content

Commit

Permalink
SEGFAULT bei Requests ohne Cookies behoben
Browse files Browse the repository at this point in the history
  • Loading branch information
Fjodor Schelichow committed Sep 19, 2024
1 parent d2e14c7 commit 1f46f59
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions mod_authnz_jwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,13 +1220,19 @@ static int auth_jwt_authn_with_token(request_rec *r){
if(json_is_string(val)) {
const char *value = json_string_value(val);

char cookie[strlen(cookie_old) + strlen(objkey) + strlen(value) + 10];
size_t new_len = strlen(objkey) + strlen(value) + 10;
if(cookie_old) {
new_len += strlen(cookie_old);
}
char cookie[new_len];
strcpy(cookie, objkey);
strcat(cookie, "=");
strcat(cookie, value);
strcat(cookie, ";Path=/");
strcat(cookie, "; ");
strcat(cookie, cookie_old);
if(cookie_old) {
strcat(cookie, cookie_old);
}
apr_table_set(r->headers_in, "Cookie", cookie);

apr_table_set(r->subprocess_env, key, value);
Expand All @@ -1236,13 +1242,19 @@ static int auth_jwt_authn_with_token(request_rec *r){
char value[len + 1];
sprintf(value, "%d", num);

char cookie[strlen(cookie_old) + strlen(objkey) + strlen(value) + 10];
size_t new_len = strlen(objkey) + strlen(value) + 10;
if(cookie_old) {
new_len += strlen(cookie_old);
}
char cookie[new_len];
strcpy(cookie, objkey);
strcat(cookie, "=");
strcat(cookie, value);
strcat(cookie, ";Path=/");
strcat(cookie, "; ");
strcat(cookie, cookie_old);
if(cookie_old) {
strcat(cookie, cookie_old);
}
apr_table_set(r->headers_in, "Cookie", cookie);

apr_table_set(r->subprocess_env, key, value);
Expand All @@ -1252,13 +1264,19 @@ static int auth_jwt_authn_with_token(request_rec *r){
char value[len + 1];
sprintf(value, "%f", num);

char cookie[strlen(cookie_old) + strlen(objkey) + strlen(value) + 10];
size_t new_len = strlen(objkey) + strlen(value) + 10;
if(cookie_old) {
new_len += strlen(cookie_old);
}
char cookie[new_len];
strcpy(cookie, objkey);
strcat(cookie, "=");
strcat(cookie, value);
strcat(cookie, ";Path=/");
strcat(cookie, "; ");
strcat(cookie, cookie_old);
if(cookie_old) {
strcat(cookie, cookie_old);
}
apr_table_set(r->headers_in, "Cookie", cookie);

apr_table_set(r->subprocess_env, key, value);
Expand Down

0 comments on commit 1f46f59

Please sign in to comment.