MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rejectCommandFormat

Function rejectCommandFormat

app/redis-6.2.6/src/server.c:3926–3943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3924}
3925
3926void rejectCommandFormat(client *c, const char *fmt, ...) {
3927 if (c->cmd) c->cmd->rejected_calls++;
3928 flagTransaction(c);
3929 va_list ap;
3930 va_start(ap,fmt);
3931 sds s = sdscatvprintf(sdsempty(),fmt,ap);
3932 va_end(ap);
3933 /* Make sure there are no newlines in the string, otherwise invalid protocol
3934 * is emitted (The args come from the user, they may contain any character). */
3935 sdsmapchars(s, "\r\n", " ", 2);
3936 if (c->cmd && c->cmd->proc == execCommand) {
3937 execCommandAbort(c, s);
3938 sdsfree(s);
3939 } else {
3940 /* The following frees 's'. */
3941 addReplyErrorSds(c, s);
3942 }
3943}
3944
3945/* Returns 1 for commands that may have key names in their arguments, but have
3946 * 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