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

Function cbm_max_file_bytes

src/foundation/limits.c:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <stdlib.h>
9
10long cbm_max_file_bytes(void) {
11 /* 512 MiB — generous: real source files never approach it, but a
12 * pathological / vendored blob degrades to a reported "oversized" skip
13 * instead of a silent drop or an unbounded read. */
14 const long default_cap = 512L * 1024 * 1024;
15
16 const char *raw = getenv("CBM_MAX_FILE_BYTES");
17 if (raw && raw[0]) {
18 errno = 0;
19 char *end = NULL;
20 long v = strtol(raw, &end, 10);
21 if (errno == 0 && end != raw && *end == '\0' && v > 0) {
22 return v;
23 }
24 /* Unparseable / non-positive → fall through to the safe default. */
25 }
26 return default_cap;
27}
28
29/* Shared env-int parser: a positive integer in [1, INT_MAX], else the fallback.
30 * Read fresh each call (see cbm_max_file_bytes rationale — cheap, test-friendly,

Callers 8

read_fileFunction · 0.85
k8s_read_fileFunction · 0.85
read_fileFunction · 0.85
extract_workerFunction · 0.85
read_fileFunction · 0.85
read_fileFunction · 0.85
read_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected