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

netrc: Return the correct error code when out of memory #4036



Copy link

@captain-caveman2k captain-caveman2k commented Jun 18, 2019

Prior to this change Curl_parsenetrc() would return 27 if the strdup() of pwdir failed even though a) the function is declared to return an int and CURLE_OUT_OF_MEMORY is an enum, and b) the description in the header file is the function "returns -1 on failure, 0 if the host is found, 1 is the host isn't found"

The knock on effect is that libcurl would attempt to info "Couldn't find host in the .netrc file; using defaults" and continue running rather than erroring with a CURLE_OUT_OF_MEMORY code straight away.

However, the chances that curl or any application developed with libcurl continuing after a memory allocation failure is very low and would presumably return the correct error code on the next allocation failure.

@captain-caveman2k captain-caveman2k deleted the netrc-result-code branch June 18, 2019 22:06
@lock lock bot locked as resolved and limited conversation to collaborators Sep 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants