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
Bugfix: Fix segfault when -H @headerfile is empty #2797
Conversation
This commit will fix a bug where the curl binary would crash if the -H command line option was given a filename to read using the @filename syntax but that file was empty.
Lovely. Any chance you could add a test case for this as well? |
This looks like it was a simple oversight I don't think it needs a test case. Also I think a better fix for this would be return an empty buffer if the file is empty. |
@jay: I felt it was a lot safer to change the error handling locally in that spot only since the file2memory function is used in a number of other places. The risk of introducing new bugs is much bigger if the behaviour of the file2memory function is changed, don't you agree? @bagder: I find it a bit hard to understand how the tests are supposed to work. I used cmake to build curl but a "make test" does not seem to be the right way to trigger the tests. I get:
Reading the README in the tests directory I get the impression that autotools should be used instead of cmake. Is autotools used when building tests and cmake when building the lib and binaries? I'm a bit confused. Can you point me in the right direction, or should we skip writing a test for this as @jay suggests? |
I now saw the note about the cmake buildsystem beeing poorly maintained. I'll try building it all using autotools instead. I guess that is the preferred way to build curl. |
I'll add a test case when I merge this! |
Thanks! |
Verifies bugfix curl#2797
Verifies bugfix curl#2797
This commit will fix a bug where the curl binary would crash if the -H
command line option was given a filename to read using the @filename
syntax but that file was empty.