-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Improve httpd string value fetching efficiency (IDFGH-14524) #15288
base: master
Are you sure you want to change the base?
Conversation
👋 Hello Adam5Wu, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
0816995
to
aa0bfd2
Compare
…ency - Avoid using `strlcpy()` when source is not null-terminated; - Avoid duplicate `strlen()` when `strlcpy()` is used.
af2b7c6
to
16d9b94
Compare
sha=16d9b94c563dda4c35c96393c58d53f75a2edc1c |
Description
strlcpy()
when source is not null-terminated;strlen()
whenstrlcpy()
is used.strlcpy()
will implicitly perform astrlen()
and report the size of source string as return value [1].This means calling
strlcpy()
when source string is no null-terminated (for the intended scope) will incur a high penalty.For example, query key-values are delimited by
&
, but callingstrlcpy()
will always have to traverse to the very end of all query key-values. Similarly for cookies.Additionally, although not 100% positive, the use of
strlcpy()
inverify_url()
could be unsafe -- as the entire buffer may not be null terminated, which could lead to crash ifstrlcpy()
scans beyond certain memory region boundaries...[1] https://linux.die.net/man/3/strlcpy
Related
Testing
Just performance improvements, no externally obverable behavioral differences.
Checklist
Before submitting a Pull Request, please ensure the following: