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

Incorrect ParseQuery logick #57

Closed
valodzka opened this issue Nov 14, 2022 · 0 comments
Closed

Incorrect ParseQuery logick #57

valodzka opened this issue Nov 14, 2022 · 0 comments

Comments

@valodzka
Copy link

valodzka commented Nov 14, 2022

ParseQuery in in collector.go incorrectly handles case when there are params before and after query

if eoq >= 0 {

It might cause incorrect results or panic: runtime error: slice bounds out of range depending on params length.

Instead of

if eoq >= 0 {
			q = queryString[i+6 : eoq+6]
			params = queryString[:i] + queryString[eoq+7:]
}

It should be:

if eoq >= 0 {
			q = queryString[i+6 : i+eoq+6]
			params = queryString[:i] + queryString[i+eoq+7:]
}

Example of problematic string:
queryString = "a=11111111111111111111111111111&query=insert into x format fmt&a=1"

nikepan added a commit that referenced this issue Nov 16, 2022
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

No branches or pull requests

1 participant