Skip to content

Commit 99a37fb

Browse files
committed
mod_session_dbd: set_cookie_name: ensure correct format
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
1 parent aee4aaf commit 99a37fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/session/mod_session_dbd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ static const char *set_cookie_name(cmd_parms * cmd, void *config, const char *ar
571571
char *line = apr_pstrdup(cmd->pool, args);
572572
session_dbd_dir_conf *conf = (session_dbd_dir_conf *) config;
573573
char *cookie = apr_strtok(line, " \t", &last);
574+
if(!cookie) {
575+
return "Invalid directive, skipping";
576+
}
574577
conf->name = cookie;
575578
conf->name_set = 1;
576579
while (apr_isspace(*last)) {
@@ -586,6 +589,9 @@ static const char *set_cookie_name2(cmd_parms * cmd, void *config, const char *a
586589
char *line = apr_pstrdup(cmd->pool, args);
587590
session_dbd_dir_conf *conf = (session_dbd_dir_conf *) config;
588591
char *cookie = apr_strtok(line, " \t", &last);
592+
if(!cookie) {
593+
return "Invalid directive, skipping";
594+
}
589595
conf->name2 = cookie;
590596
conf->name2_set = 1;
591597
while (apr_isspace(*last)) {

0 commit comments

Comments
 (0)