diff options
author | Eric Covener <covener@apache.org> | 2025-01-06 20:28:35 +0100 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2025-01-06 20:28:35 +0100 |
commit | 75facde270f0c082992341c0f71b4bb44a960a8f (patch) | |
tree | d7e1f6cfcb920d572d49d054a98943fd25a45aef /modules/session/mod_session_dbd.c | |
parent | fix value inconsistency in LimitXMLRequestBody example (diff) | |
download | apache2-75facde270f0c082992341c0f71b4bb44a960a8f.tar.xz apache2-75facde270f0c082992341c0f71b4bb44a960a8f.zip |
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
Submitted by: Thomas Meyer <thomas@m3y3r.de>
Github: closes #503
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1922931 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/session/mod_session_dbd.c')
-rw-r--r-- | modules/session/mod_session_dbd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/session/mod_session_dbd.c b/modules/session/mod_session_dbd.c index f683da2172..619addb7b6 100644 --- a/modules/session/mod_session_dbd.c +++ b/modules/session/mod_session_dbd.c @@ -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)) { @@ -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)) { |