Skip to content

Commit 9d77dcc

Browse files
Fix \\ bug
1 parent 9a40204 commit 9d77dcc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ngx_http_auth_digest_module.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ ngx_http_auth_digest_check_credentials(ngx_http_request_t *r, ngx_http_auth_dige
477477
}
478478
else if (ch == '\\' && *p <= 0x7f) {
479479
quoted_pair_count++;
480+
/* Skip the next char, even if it's a \ */
480481
ch = *(p += 2);
481482
}
482483
else if (ch == '\"') {
@@ -490,7 +491,16 @@ ngx_http_auth_digest_check_credentials(ngx_http_request_t *r, ngx_http_auth_dige
490491
u_char *s = start;
491492
for (; s < end; s++) {
492493
ch = *s;
493-
if (ch == '\\') continue;
494+
if (ch == '\\') {
495+
/* Make sure to add the next character
496+
* even if it's a \
497+
*/
498+
s++;
499+
if (s < end) {
500+
*d++ = ch;
501+
}
502+
continue;
503+
}
494504
*d++ = ch;
495505
}
496506
}

0 commit comments

Comments
 (0)