Skip to content

Fix bounds check in name_parse function #1846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yannaingtun
Copy link

Description
Added a bounds check before memcpy operation in name_parse() function to improve security. This ensures that label_len bytes can be safely read from the packet buffer before copying memory. The fix prevents potential out-of-bounds reads when processing malformed DNS packets.

The fix adds:
if (j + label_len > length) return -1;

References:
Original fix: libevent/libevent@96f64a0
CVE-2016-10195: https://nvd.nist.gov/vuln/detail/CVE-2016-10195

Add missing buffer bounds validation before memcpy operation
to prevent potential out-of-bounds read.
@100manbul
Copy link

Description
Added a bounds check before memcpy operation in name_parse() function to improve security. This ensures that label_len bytes can be safely read from the packet buffer before copying memory. The fix prevents potential out-of-bounds reads when processing malformed DNS packets.

The fix adds:
if (j + label_len > length) return -1;

References:
Original fix: libevent/libevent@96f64a0
CVE-2016-10195: https://nvd.nist.gov/vuln/detail/CVE-2016-10195

@100manbul
Copy link

@yannaingtun
Copy link
Author

Hi @Arash63Dehghan, thanks for reviewing and approving the PR! I just wanted to check if you're planning to merge it. Please let me know if you have any concerns.

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.

3 participants