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 issue #5506 "WebServer serveStatic () can cause LoadProhibited ex… #5508

Merged
merged 1 commit into from Aug 11, 2021

Conversation

timr49
Copy link
Contributor

@timr49 timr49 commented Aug 8, 2021

…ception in _svfprintf_r"

"Using a Core Debug Level of Verbose and the WebServer serveStatic() function with the default value of nullptr for its cache_header argument, results in a LoadProhibited exception in _svfprintf_r().
This is because serveStatic() calls log_v() with cache_header corresponding to a "%s" in its format but without checking that cache_header is not nullptr, and then logv() (indirectly) calls _svfprintf_r().
On the other hand, with a Core Debug Level other than Verbose, this does not occur."

Changed serveStatic() to check the value of cache_header and if it is nullptr, instead pass an empty string to log_v().


This entire section can be deleted if all items are checked.

By completing this PR sufficiently, you help us to improve the quality of Release Notes

Checklist

  1. Please provide specific title of the PR describing the change, including the component name (eg."Update of Documentation link on Readme.md")
  2. Please provide related links (eg. Issue, other Project, submodule PR..)

Summary

Fix issue #5506 "WebServer serveStatic () can cause LoadProhibited exception in _svfprintf_r"

Impact

This change adds null-ness checking to the cache_header argument in WebServer::serveStatic() before passing it to log_v(). If it is null, it passes an empty string ("") instead of nullptr. The only intended/expected impact is to prevent a LoadProhibited exception in _svfprintf_r when serveStatic() is called with a nullptr value for its argument cache_header, which for example, occurs when the default value for cache_header is used.

…ibited exception in _svfprintf_r"

"Using a Core Debug Level of Verbose and the WebServer serveStatic() function with the default value of nullptr for its cache_header argument, results in a LoadProhibited exception in _svfprintf_r().
This is because serveStatic() calls log_v() with cache_header corresponding to a "%s" in its format but without checking that cache_header is not nullptr, and then logv() (indirectly) calls _svfprintf_r().
On the other hand, with a Core Debug Level other than Verbose, this does not occur."

Changed serveStatic() to the check value of cache_header and if it is nullptr, instead pass an empty string to log_v().
@CLAassistant
Copy link

CLAassistant commented Aug 8, 2021

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit c4fcab2 into espressif:master Aug 11, 2021
@me-no-dev
Copy link
Member

Thanks @timr49 :)

@VojtechBartoska
Copy link
Collaborator

Close #5506

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.

None yet

5 participants