Skip to content

Conversation

thomasmey
Copy link

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

@@ -571,6 +571,9 @@ 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 "Invalid directive, skipping";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string has "skipping" but won't this result in a startup error? Maybe "SessionDBDCookieName requires at least one argument"?

@@ -571,6 +571,9 @@ 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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. httpd style has a space between if and (

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
@thomasmey thomasmey force-pushed the bugfix/ap_config_fuzzing1 branch from 99a37fb to 66ffcfa Compare January 1, 2025 15:47
@asfgit asfgit closed this in 75facde Jan 6, 2025
covener added a commit to covener/httpd that referenced this pull request Jan 6, 2025
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 apache#503

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1922931 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 75facde)
asfgit pushed a commit that referenced this pull request Jun 10, 2025
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


Follow-up to r1922931.

In set_cookie_name() and set_cookie_name2(), now that the empty 'name' argument is explicitly handled, the error message in check_string() can be simplified because the cookie name can't be empty anymore when this function is called.


Add a change entry to give credits to the author.


Merges r1922931, r1926188, r1926189 trunk
Submitted by: covener, jailletc36, jailletc36
Reviewed by: jailletc36, rpluem, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1926325 13f79535-47bb-0310-9956-ffa450edef68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants