Skip to content

Infinite loop on CURLOPT_COOKIEFILE="/" #20823

@rtollert

Description

@rtollert

I did this

Our code is calling curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/") instead of "" for hysterical raisins. While obviously problematic, I am not certain that it is forbidden? CURLOPT_COOKIEFILE(3) states that specifying a non-existent file, while not a good idea, should work identically to "". And, well, one could argue that the “file” / does not, strictly speaking, exist. (I admit this may be a bit of a stretch.)

Anyways, when we upgraded from 8.14 to 8.18 our code started hanging. Root cause appears to be curl_get_line: enhance the API. The crux is that fopen() on a directory works, even though fgets() will always fail — yet feof() always returns 0. (At least on my Linux box.)

I expected the following

It definitely shouldn't hang. I would prefer that setting a CURLOPT_COOKIEFILE="/" be treated equivalent to "", but in light of the whole purpose of 769ccb4 being to tighten up error handling, I could be persuaded that perhaps an error should now be returned. (EDIT: we've all agreed that the correct behavior is for directories to error out.)

curl/libcurl version

Regression observed in curl 8.18.0 versus 8.14.1

operating system

Observed both on Arch Linux and on a Yocto variant.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions