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: buffer overflow with strtol #1251

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

tyler92
Copy link
Contributor

@tyler92 tyler92 commented Oct 13, 2024

Closes #1193

The buffer overflow is fixed and checked with the fuzzing test but I would still appreciate feedback about the correctness of the parsing part. The main differences between strtol and from_chars as it was said here:

1/ from_chars does not ignore leading white space, strtol does.
2/ from_chars does not recognize a leading "+" sign (or signs), whereas strtol treats a leading plus (or pluses) as indicating that the value is positive, which is the default in any case.

I didn't add ignoring leading spaces because the code does it before from_chars. Also, I didn't find in many RFCs that leading + is allowed.

Copy link
Member

@Tachi107 Tachi107 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! This will also close #1208 when merged

@kiplingw
Copy link
Member

@tyler92, I'm almost ready to merge. But can you please bump the patch version in version.txt because you've changed the internal implementation?

@tyler92
Copy link
Contributor Author

tyler92 commented Oct 18, 2024

can you please bump the patch version in version.txt because you've changed the internal implementation?

Done, 0.4.11.20241018

@kiplingw kiplingw merged commit 2d573ad into pistacheio:master Oct 18, 2024
154 of 156 checks passed
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.

Out of bound read in std::strtol while parsing HTTP requests
3 participants