MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / application_framable_response

Function application_framable_response

src/daemon/application.c:2398–2405  ·  view source on GitHub ↗

Decide whether `response` can be framed, substituting the error when it * cannot. Owns `response` either way and returns the reply to send, or NULL * only on allocation failure. This is ONE function on purpose: the bug was the * DECISION (an oversized reply travelling on as if it were fine), so the * decision and the substitution have to be testable together — a test that * only builds the er

Source from the content-addressed store, hash-verified

2396 * decision and the substitution have to be testable together — a test that
2397 * only builds the error passes even with the size check removed. */
2398static char *application_framable_response(char *response, const cbm_jsonrpc_request_t *request) {
2399 if (!response || strlen(response) <= CBM_DAEMON_RUNTIME_APPLICATION_PAYLOAD_MAX) {
2400 return response;
2401 }
2402 char *replacement = application_oversized_response_error(request, strlen(response));
2403 free(response);
2404 return replacement;
2405}
2406
2407char *cbm_daemon_application_framable_response_for_test(char *response,
2408 const cbm_jsonrpc_request_t *request) {

Tested by

no test coverage detected