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
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
/* Provenance: curl/curl mqtt_send (fixed).
|
|
* repo: curl/curl
|
|
* commit: 43157490a5054bd24256fe12876931e8abc9df49
|
|
* parent: 409a4412409371db00af0a3fe987e517bfab3d19
|
|
* commit_url: https://github.com/curl/curl/commit/43157490a5054bd24256fe12876931e8abc9df49
|
|
* cve: CVE-2021-22945
|
|
* license: curl
|
|
* function: mqtt_send
|
|
* relpath: lib/mqtt.c
|
|
* provenance: human
|
|
* mechanism: other
|
|
*/
|
|
|
|
static CURLcode mqtt_send(struct Curl_easy *data,
|
|
char *buf, size_t len)
|
|
{
|
|
CURLcode result = CURLE_OK;
|
|
struct connectdata *conn = data->conn;
|
|
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
|
|
struct MQTT *mq = data->req.p.mqtt;
|
|
ssize_t n;
|
|
result = Curl_write(data, sockfd, buf, len, &n);
|
|
if(!result)
|
|
Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
|
|
if(len != (size_t)n) {
|
|
size_t nsend = len - n;
|
|
char *sendleftovers = Curl_memdup(&buf[n], nsend);
|
|
if(!sendleftovers)
|
|
return CURLE_OUT_OF_MEMORY;
|
|
mq->sendleftovers = sendleftovers;
|
|
mq->nsend = nsend;
|
|
}
|
|
else {
|
|
mq->sendleftovers = NULL;
|
|
mq->nsend = 0;
|
|
}
|
|
return result;
|
|
}
|