Skip to content

Commit

Permalink
mod_session_dbd: set_cookie_name: ensure correct format
Browse files Browse the repository at this point in the history
If args is an empty string, apr_strtok will return NULL and *last will never get set which results in a SIGSEGV in apr_isspace check

Submitted by: Thomas Meyer <[email protected]>

Github: closes #503

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1922931 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 75facde)
  • Loading branch information
covener authored and Eric Covener committed Jan 6, 2025
1 parent 5fe106b commit d332155
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/session/mod_session_dbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@ static const char *set_cookie_name(cmd_parms * cmd, void *config, const char *ar
char *line = apr_pstrdup(cmd->pool, args);
session_dbd_dir_conf *conf = (session_dbd_dir_conf *) config;
char *cookie = apr_strtok(line, " \t", &last);
if (!cookie) {
return apr_pstrcat(cmd->pool, cmd->directive->directive,
" requires at least one argument!",
NULL);
}
conf->name = cookie;
conf->name_set = 1;
while (apr_isspace(*last)) {
Expand All @@ -586,6 +591,11 @@ static const char *set_cookie_name2(cmd_parms * cmd, void *config, const char *a
char *line = apr_pstrdup(cmd->pool, args);
session_dbd_dir_conf *conf = (session_dbd_dir_conf *) config;
char *cookie = apr_strtok(line, " \t", &last);
if (!cookie) {
return apr_pstrcat(cmd->pool, cmd->directive->directive,
" requires at least one argument!",
NULL);
}
conf->name2 = cookie;
conf->name2_set = 1;
while (apr_isspace(*last)) {
Expand Down

0 comments on commit d332155

Please sign in to comment.