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

Function yaml_validate_key

src/cli/config_yaml_edit.c:279–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279static int yaml_validate_key(const char *key, size_t *out_len) {
280 size_t len = 0;
281 if (yaml_bounded_strlen(key, YAML_KEY_MAX, &len) != 0 || len == 0U) {
282 return YAML_ERROR;
283 }
284 for (size_t i = 0; i < len; i++) {
285 unsigned char c = (unsigned char)key[i];
286 if (!(isalnum(c) || c == '_' || c == '-' || c == '.')) {
287 return YAML_ERROR;
288 }
289 }
290 *out_len = len;
291 return 0;
292}
293
294static int yaml_validate_text_bytes(const char *data, size_t len) {
295 if (len >= YAML_UTF8_BOM_LEN && (unsigned char)data[0] == YAML_BOM_BYTE_0 &&

Calls 1

yaml_bounded_strlenFunction · 0.85

Tested by

no test coverage detected