Skip to content

Commit 51cc0e1

Browse files
fix: Prevent buffer overflow with long domain filter
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
1 parent 30b56bc commit 51cc0e1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

modules/tls_mgm/tls_domain.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ tls_find_domain_by_filters(struct ip_addr *ip, unsigned short port,
338338
dom_array = (struct dom_filt_array *)*val;
339339

340340
for (i = 0; i < dom_array->size; i++) {
341+
if (domain_filter->len >= sizeof(fnm_s)) {
342+
LM_WARN("domain filter '%.*s' too long, skipping match\n",
343+
domain_filter->len, domain_filter->s);
344+
continue;
345+
}
341346
memcpy(fnm_s, domain_filter->s, domain_filter->len);
342347
fnm_s[domain_filter->len] = 0;
343348
if (!fnmatch(dom_array->arr[i].hostname->s.s, fnm_s, 0)) {

0 commit comments

Comments
 (0)