examples/http2-upload: fix a crash - #5463
Closed
rgeorgiev583 wants to merge 3 commits into
Closed
Conversation
If `index.html` does not exist in the directory from which the example is invoked, the fopen(upload, "rb") invocation in `setup` would fail, returning NULL. This value is subsequently passed as the FILE* argument of the `fread` invocation in the `read_callback` function, which is the actual cause of the crash (apparently `fread` assumes that argument to be non-null). In addition, mitigate some possible crashes of similar origin.
Member
|
'make checksrc' found a few code style nits: |
Member
|
ping @rgeorgiev583 ? |
Contributor
Author
|
Sorry for not responding; was a bit busy recently. Am also sorry for overlooking the code style guide. I'm pushing the fixes now; hope the checks would turn out fine after that :) |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
index.htmldoes not exist in the directory from which the exampleis invoked, the
fopen(upload, "rb")invocation insetupwould fail,returning
NULL. This value is subsequently passed as theFILE*argumentof the
freadinvocation in theread_callbackfunction, which is theactual cause of the crash (apparently
freadassumes that argument tobe non-null).
In addition, mitigate some possible crashes of similar origin.