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

response size check on keyListResponseWithCorrectSize breaks with 32bit keys and keyring size >20 #647

Closed
danieleva opened this issue Apr 11, 2022 · 0 comments · Fixed by #649

Comments

@danieleva
Copy link

The function fkeyListResponseWithCorrectSize has an issue in the logic used to decide when to truncate the response. It does a decreasing loop starting from q.serf.config.QueryResponseSizeLimit / minEncodedKeyLength, and truncates the list until the message can fit into q.serf.config.QueryResponseSizeLimit. If the value of q.serf.config.QueryResponseSizeLimit / minEncodedKeyLength higher than len(resp.Keys), the truncate operation causes a panic.
We discover the bug in consul, with the default configuration q.serf.config.QueryResponseSizeLimit / minEncodedKeyLength is 40, and it takes 38 16bit keys or 22 32bit keys to trigger the bug and crash a consul server sending a list keyring rpc. The test doesn't catch the bug as it uses a list with 50 items.

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 a pull request may close this issue.

1 participant