Skip to content

Fix never-matching wildcard cookie domain comparison - #317

Merged
xroche merged 1 commit into
masterfrom
fix/cookie-cmp-loop
Jun 9, 2026
Merged

xroche merged 1 commit into
masterfrom
fix/cookie-cmp-loop

Conversation

@xroche

@xroche xroche commented Jun 9, 2026

Copy link
Copy Markdown
Owner

cookie_cmp_wildcard_domain (src/htsbauth.c) used an unsigned size_t loop counter, so i >= 0 was always true: an infinite loop with out-of-bounds reads, and wildcard cookie-domain matching never returned correctly. An empty domain also underflowed l - 1 to SIZE_MAX. Switching to a signed counter fixes both.

The actual fix from #172 by @greenrd, applied directly because that PR also carried 8-year-old regenerated build files that can't merge. closes #171

cookie_cmp_wildcard_domain used an unsigned loop counter, so i >= 0 was always
true (infinite loop and out-of-bounds reads) and an empty domain underflowed
l - 1. Use a signed counter. Found and fixed by greenrd in #172. closes #171
@xroche
xroche merged commit b21f85c into master Jun 9, 2026
5 checks passed
@xroche
xroche deleted the fix/cookie-cmp-loop branch June 9, 2026 18:12
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.

cookie_cmp_wildcard_domain never matches

1 participant