mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 20:49:28 +00:00
Tasks 3.3 and 4.1. - vfc curl and openssl-cve-2021-3449 excerpts re-harvested through the shared library: whole functions with upstream_start headers, the vendored key redacted code-safely, no truncated bodies. - vfc/recipes.toml carries mode, fix_path and function anchors; training/manifest.jsonl regenerated. - Juliet CWE-121 strcpy pair gets its buffer declarations back so the vulnerable side is a real overflow again. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
61 lines
1.5 KiB
C
61 lines
1.5 KiB
C
/* Provenance: curl/curl Curl_open (fixed).
|
|
* repo: curl/curl
|
|
* commit: 3c9e021f86872baae412a427e807fbfa2f3e8a22
|
|
* parent: 687908c6e6332b2bf4ba74b271e795f9c65a5a61
|
|
* commit_url: https://github.com/curl/curl/commit/3c9e021f86872baae412a427e807fbfa2f3e8a22
|
|
* cve: CVE-2020-8231
|
|
* license: curl
|
|
* function: Curl_open
|
|
* relpath: lib/url.c
|
|
* provenance: human
|
|
* mechanism: other
|
|
*/
|
|
|
|
CURLcode Curl_open(struct Curl_easy **curl)
|
|
{
|
|
CURLcode result;
|
|
struct Curl_easy *data;
|
|
|
|
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
|
data = calloc(1, sizeof(struct Curl_easy));
|
|
if(!data) {
|
|
/* this is a very serious error */
|
|
DEBUGF(fprintf(stderr, "Error: calloc of Curl_easy failed\n"));
|
|
return CURLE_OUT_OF_MEMORY;
|
|
}
|
|
|
|
data->magic = CURLEASY_MAGIC_NUMBER;
|
|
|
|
result = Curl_resolver_init(data, &data->state.resolver);
|
|
if(result) {
|
|
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
|
free(data);
|
|
return result;
|
|
}
|
|
|
|
result = Curl_init_userdefined(data);
|
|
if(!result) {
|
|
Curl_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
|
|
Curl_convert_init(data);
|
|
Curl_initinfo(data);
|
|
|
|
/* most recent connection is not yet defined */
|
|
data->state.lastconnect_id = -1;
|
|
|
|
data->progress.flags |= PGRS_HIDE;
|
|
data->state.current_speed = -1; /* init to negative == impossible */
|
|
}
|
|
|
|
if(result) {
|
|
Curl_resolver_cleanup(data->state.resolver);
|
|
Curl_dyn_free(&data->state.headerb);
|
|
Curl_freeset(data);
|
|
free(data);
|
|
data = NULL;
|
|
}
|
|
else
|
|
*curl = data;
|
|
|
|
return result;
|
|
}
|