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

cookies: fp is always not NULL #10383

Closed
wants to merge 1 commit into from
Closed

cookies: fp is always not NULL #10383

wants to merge 1 commit into from

Conversation

kvarec
Copy link
Contributor

@kvarec kvarec commented Feb 1, 2023

if (fp) {
...
    if(fromfile && fp) // At this line fp is always not null
...
}

kvarec referenced this pull request Feb 1, 2023
The existing programming had some issues with errorhandling for reading
the cookie file. If the file failed to open, we would silently ignore it
and continue as if there was no file (or stdin) passed. In this case, we
would also call fclose() on the NULL FILE pointer, which is undefined
behavior. Fix by ensuring that the FILE pointer is set before calling
fclose on it, and issue a warning in case the file cannot be opened.
Erroring out on nonexisting file would break backwards compatibility of
very old behavior so we can't really go there.

Closes: #8699
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Jay Satiro <raysatiro@yahoo.com>
@bagder
Copy link
Member

bagder commented Feb 1, 2023

Thanks!

@bagder bagder closed this in 9caa7bc Feb 1, 2023
bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants