Skip to content

Commit 213cd1e

Browse files
committed
Fixed: detect comma plus white space as a cookie separator - change variable names
1 parent 80146b2 commit 213cd1e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

apache2/modsecurity.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ static apr_status_t modsecurity_tx_cleanup(void *data) {
276276
apr_status_t modsecurity_tx_init(modsec_rec *msr) {
277277
const char *s = NULL;
278278
const apr_array_header_t *arr;
279-
char *_cookies = NULL;
279+
char *semicolon = NULL;
280+
char *comma = NULL;
280281
apr_table_entry_t *te;
281282
int i;
282283

@@ -402,16 +403,16 @@ apr_status_t modsecurity_tx_init(modsec_rec *msr) {
402403
for (i = 0; i < arr->nelts; i++) {
403404
if (strcasecmp(te[i].key, "Cookie") == 0) {
404405
if (msr->txcfg->cookie_format == COOKIES_V0) {
405-
_cookies = apr_pstrdup(msr->mp, te[i].val);
406-
while((*_cookies != 0)&&(*_cookies != ';')) _cookies++;
407-
if(*_cookies == ';') {
406+
semicolon = apr_pstrdup(msr->mp, te[i].val);
407+
while((*semicolon != 0)&&(*semicolon != ';')) semicolon++;
408+
if(*semicolon == ';') {
408409
parse_cookies_v0(msr, te[i].val, msr->request_cookies, ";");
409410
} else {
410-
_cookies = apr_pstrdup(msr->mp, te[i].val);
411-
while((*_cookies != 0)&&(*_cookies != ',')) _cookies++;
412-
if(*_cookies == ',') {
413-
_cookies++;
414-
if(*_cookies == 0x20) {// looks like comma is the separator
411+
comma = apr_pstrdup(msr->mp, te[i].val);
412+
while((*comma != 0)&&(*comma != ',')) comma++;
413+
if(*comma == ',') {
414+
comma++;
415+
if(*comma == 0x20) {// looks like comma is the separator
415416
if (msr->txcfg->debuglog_level >= 5) {
416417
msr_log(msr, 5, "Cookie v0 parser: Using comma as a separator. Semi-colon was not identified!");
417418
}

0 commit comments

Comments
 (0)