Skip to content

Fix buffer overflow in dnscache (#3669)#3672

Merged
bogdan-iancu merged 1 commit into
OpenSIPS:masterfrom
jes:dnscache-fix
Jun 16, 2025
Merged

Fix buffer overflow in dnscache (#3669)#3672
bogdan-iancu merged 1 commit into
OpenSIPS:masterfrom
jes:dnscache-fix

Conversation

@jes
Copy link
Copy Markdown
Contributor

@jes jes commented Jun 12, 2025

Summary
Fix buffer overflow in dnscache (#3669)

@pb-dstny wrote this fix for our internal use.

Details
addr_no and alias_no are calculated based on whichever is smaller out of the actual number of addresses/aliases, and MAXADDRS-1/MAXALIASES-1.

But then the code inserted all of the actual number of addresses/aliases anyway, which makes for a potential buffer overflow, and corrupted deserialisation later.

Solution
This PR fixes the problem by using the calculated values of addr_no and alias_no.

Compatibility

Closing issues
closes #3669

`addr_no` and `alias_no` are calculated based on whichever is
smaller out of the actual number of addresses/aliases, and
`MAXADDRS-1`/`MAXALIASES-1`.

But then the code inserted all of the actual number of
addresses/aliases anyway, which makes for a potential buffer
overflow, and corrupted deserialisation later.
@bogdan-iancu bogdan-iancu self-assigned this Jun 16, 2025
@bogdan-iancu bogdan-iancu merged commit 0371946 into OpenSIPS:master Jun 16, 2025
51 of 86 checks passed
@bogdan-iancu
Copy link
Copy Markdown
Member

Good catch @jes and @pb-dstny !!

bogdan-iancu added a commit that referenced this pull request Jun 16, 2025
Fix buffer overflow in dnscache (#3669)

(cherry picked from commit 0371946)
bogdan-iancu added a commit that referenced this pull request Jun 16, 2025
Fix buffer overflow in dnscache (#3669)

(cherry picked from commit 0371946)
NormB pushed a commit to NormB/opensips that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants