mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 10:46:21 +00:00
fix(ai): return CURL_WRITEFUNC_ERROR on oversized response
Return CURL_WRITEFUNC_ERROR instead of realsize when the response exceeds 10MB. This causes curl to abort the transfer immediately instead of continuing to stream data.
This commit is contained in:
@@ -50,8 +50,8 @@ _write_callback(void* ptr, size_t size, size_t nmemb, void* userdata)
|
||||
|
||||
/* Limit response size to 10MB to prevent OOM */
|
||||
if (res->size + realsize > 10 * 1024 * 1024) {
|
||||
log_error("[AI-THREAD] Response too large, truncating");
|
||||
return realsize;
|
||||
log_error("[AI-THREAD] Response too large, aborting transfer");
|
||||
return CURL_WRITEFUNC_ERROR;
|
||||
}
|
||||
|
||||
gchar* new_data = g_realloc(res->data, res->size + realsize + 1);
|
||||
|
||||
Reference in New Issue
Block a user