MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / rejectCommandFormat

Function rejectCommandFormat

src/server.cpp:4755–4772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4753}
4754
4755void rejectCommandFormat(client *c, const char *fmt, ...) {
4756 if (c->cmd) c->cmd->rejected_calls++;
4757 flagTransaction(c);
4758 va_list ap;
4759 va_start(ap,fmt);
4760 sds s = sdscatvprintf(sdsempty(),fmt,ap);
4761 va_end(ap);
4762 /* Make sure there are no newlines in the string, otherwise invalid protocol
4763 * is emitted (The args come from the user, they may contain any character). */
4764 sdsmapchars(s, "\r\n", " ", 2);
4765 if (c->cmd && c->cmd->proc == execCommand) {
4766 execCommandAbort(c, s);
4767 sdsfree(s);
4768 } else {
4769 /* The following frees 's'. */
4770 addReplyErrorSds(c, s);
4771 }
4772}
4773
4774/* Returns 1 for commands that may have key names in their arguments, but have
4775 * no pre-determined key positions. */

Callers 1

processCommandFunction · 0.85

Calls 7

flagTransactionFunction · 0.85
sdscatvprintfFunction · 0.85
sdsemptyFunction · 0.85
sdsmapcharsFunction · 0.85
execCommandAbortFunction · 0.85
sdsfreeFunction · 0.85
addReplyErrorSdsFunction · 0.85

Tested by

no test coverage detected