Skip to content

Stack overflow in libcurl when CURLOPT_WILDCARDMATCH is in use #6255

Closed
@xnynx

Description

@xnynx
#include <curl/curl.h>

long ChunkBgnFunction(const struct curl_fileinfo *finfo, struct callback_data *, int)
{
	if (finfo->filetype == CURLFILETYPE_FILE)
		return CURL_CHUNK_BGN_FUNC_SKIP;

	return CURL_CHUNK_BGN_FUNC_OK;
}

void main()
{
	curl_global_init(CURL_GLOBAL_ALL);

	auto curl = curl_easy_init();

	curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

	curl_easy_setopt(curl, CURLOPT_URL, "ftp://gdc.cddis.eosdis.nasa.gov/gnss/data/daily/2020/brdc/*");
	curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
	curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);

	curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, ChunkBgnFunction);

	const CURLcode code = curl_easy_perform(curl);

	curl_easy_cleanup(curl);

	curl_global_cleanup();
}

The reason is about 1700 files in the directory.

libcurl version: 7.73.0
compiler: VS2019 16.7.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions