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

Handle incorrect bulk string size in RESP by returning adequate error message instead of panicking #3

Merged

Conversation

xsni1
Copy link
Contributor

@xsni1 xsni1 commented Mar 26, 2024

I've noticed that wrong bulk string size in RESP results in panic. I've added some checks to prevent this behavior and return user friendly message.
It can be tested either by running parser_test.go tests that I've added or by sending malformed packet:
e.g. echo -e -n "*3\r\n\$4\r\nSET\r\n\$1\r\nA\r\n\$1\r\nB\r\n" | nc 127.0.0.1 6379

This is my first time contributing, let me know if I am doing something incorrectly.

@Dhravya
Copy link
Owner

Dhravya commented Mar 26, 2024

amazing PR! LGTM. Thank you so much for the contribution

@Dhravya Dhravya merged commit 4267985 into Dhravya:main Mar 26, 2024
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.

2 participants