mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 20:49:28 +00:00
Harvest 176 isolated vuln-vs-fix functions (109 CVEs, 352 training rows) into benchmarks/pairs/vfc with provenance and a JSONL training manifest. Score the slice as an honesty dashboard (ousast pairs --slice vfc); keep the pair gate on the local fixtures only.
37 lines
1.0 KiB
C
37 lines
1.0 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
|
|
*/
|
|
|
|
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;
|
|
}
|