mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 04:29:27 +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
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/* Provenance: curl/curl hashkey (fixed).
|
|
* repo: curl/curl
|
|
* commit: 058f98dc3fe595f21dc26a5b9b1699e519ba5705
|
|
* parent: 852aa5ad351ea53e5f01d2f44b5b4370c2bf5425
|
|
* commit_url: https://github.com/curl/curl/commit/058f98dc3fe595f21dc26a5b9b1699e519ba5705
|
|
* cve: CVE-2022-27775
|
|
* license: curl
|
|
* function: hashkey
|
|
* relpath: lib/conncache.c
|
|
* provenance: human
|
|
* mechanism: other
|
|
*/
|
|
|
|
static void hashkey(struct connectdata *conn, char *buf,
|
|
size_t len, /* something like 128 is fine */
|
|
const char **hostp)
|
|
{
|
|
const char *hostname;
|
|
long port = conn->remote_port;
|
|
|
|
#ifndef CURL_DISABLE_PROXY
|
|
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
|
|
hostname = conn->http_proxy.host.name;
|
|
port = conn->port;
|
|
}
|
|
else
|
|
#endif
|
|
if(conn->bits.conn_to_host)
|
|
hostname = conn->conn_to_host.name;
|
|
else
|
|
hostname = conn->host.name;
|
|
|
|
if(hostp)
|
|
/* report back which name we used */
|
|
*hostp = hostname;
|
|
|
|
/* put the numbers first so that the hostname gets cut off if too long */
|
|
#ifdef ENABLE_IPV6
|
|
msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
|
|
#else
|
|
msnprintf(buf, len, "%ld/%s", port, hostname);
|
|
#endif
|
|
Curl_strntolower(buf, buf, len);
|
|
}
|