Files
Open_Ultra_SAST/benchmarks/pairs/vfc/curl-cve-2022-30115/fixed.c
T
Marius CiepluchandClaude Fable 5.1 c3e841003c fix(pair-corpus-honesty): re-harvest curl/OpenSSL excerpts, restore Juliet fixtures
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
2026-09-05 10:45:42 +02:00

42 lines
1.1 KiB
C

/* Provenance: curl/curl hsts_create (fixed).
* repo: curl/curl
* commit: fae6fea209a2d4db1582f608bd8cc8000721733a
* parent: ff3ee510c328db03bf171cae6179bb9463fb054f
* commit_url: https://github.com/curl/curl/commit/fae6fea209a2d4db1582f608bd8cc8000721733a
* cve: CVE-2022-30115
* license: curl
* function: hsts_create
* relpath: lib/hsts.c
* provenance: human
* mechanism: other
*/
static CURLcode hsts_create(struct hsts *h,
const char *hostname,
bool subdomains,
curl_off_t expires)
{
struct stsentry *sts = hsts_entry();
char *duphost;
size_t hlen;
if(!sts)
return CURLE_OUT_OF_MEMORY;
duphost = strdup(hostname);
if(!duphost) {
free(sts);
return CURLE_OUT_OF_MEMORY;
}
hlen = strlen(duphost);
if(duphost[hlen - 1] == '.')
/* strip off trailing any dot */
duphost[--hlen] = 0;
sts->host = duphost;
sts->expires = expires;
sts->includeSubDomains = subdomains;
Curl_llist_insert_next(&h->list, h->list.tail, sts, &sts->node);
return CURLE_OK;
}