Skip to content
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

Fix 'index out of range' bug in Packetbeat DNS protocol plugin #2875

Merged

Conversation

andrewkroh
Copy link
Member

When converting resource records into MapStrs the code can run into an index out of range exception when processing OPT psuedo resource records. The code reduces the size of a slice by creating a new, smaller slice and copies the existing data to the smaller slice. But the code did not account for the fact that the length of the slice was smaller when indexing.

Fixes #2872

When converting resource records into MapStrs the code can run into an index out of range exception when processing OPT psuedo resource records. The code reduces the size of a slice by creating a new, smaller slice and copies the existing data to the smaller slice. But the code did not account for the fact that the length of the slice was smaller when indexing.

Fixes elastic#2872
@andrewkroh andrewkroh added bug Packetbeat needs_backport PR is waiting to be backported to other branches. labels Oct 28, 2016
@tsg
Copy link
Contributor

tsg commented Oct 28, 2016

LGTM. Would a unit test on that function be possible?

@andrewkroh
Copy link
Member Author

@tsg I added a test case that breaks the original rrsToMapStrs function.

@ruflin ruflin merged commit e8b1307 into elastic:master Oct 31, 2016
@andrewkroh andrewkroh removed the needs_backport PR is waiting to be backported to other branches. label Nov 1, 2016
@andrewkroh andrewkroh deleted the bugfix/packetbeat-dns-opt-index-out-of-bounds branch November 2, 2016 22:36
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.

3 participants