diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 09:35:06 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 09:35:41 +0200 |
| commit | cc0bf3467b33c32922ec78eb0cf4fffbd90483c2 (patch) | |
| tree | ac52b8ca3d6680fefeac39b9fea55b7d49898069 /src/protocol.c | |
| parent | b6aeaa8995ae81562a4bf11937959b09027116ff (diff) | |
| download | bokf-cc0bf3467b33c32922ec78eb0cf4fffbd90483c2.tar.gz bokf-cc0bf3467b33c32922ec78eb0cf4fffbd90483c2.zip | |
commands: declarative argument schemas with dispatch validation
Diffstat (limited to 'src/protocol.c')
| -rw-r--r-- | src/protocol.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/protocol.c b/src/protocol.c index c528759..d9019ba 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -176,6 +176,12 @@ char *protocol_handle_line(sqlite3 *db, const char *line, size_t len) } { + char verr[512]; + if (cmd->nargs && + command_validate_args(cmd, r.args, verr, sizeof verr) != 0) { + add_error(rdoc, resp, "INVALID_ARGS", verr, NULL); + goto done; + } yyjson_mut_val *result = cmd->fn(&r); if (!result) { add_error(rdoc, resp, r.err_code ? r.err_code : "INTERNAL", |
