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

Function getSafeInfoString

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

Returns a sanitized version of s that contains no unsafe info string chars. * If no unsafe characters are found, simply returns s. Caller needs to * free tmp if it is non-null on return. */

Source from the content-addressed store, hash-verified

4616 * free tmp if it is non-null on return.
4617 */
4618const char *getSafeInfoString(const char *s, size_t len, char **tmp) {
4619 *tmp = NULL;
4620 if (mempbrk(s, len, unsafe_info_chars,sizeof(unsafe_info_chars)-1)
4621 == NULL) return s;
4622 char *new = *tmp = zmalloc(len + 1);
4623 memcpy(new, s, len);
4624 new[len] = '\0';
4625 return memmapchars(new, len, unsafe_info_chars, unsafe_info_chars_substs,
4626 sizeof(unsafe_info_chars)-1);
4627}
4628
4629/* Create the string returned by the INFO command. This is decoupled
4630 * by the INFO command itself as we need to report the same information

Callers 2

genRedisInfoStringFunction · 0.85
RM_InfoBeginDictFieldFunction · 0.85

Calls 4

mempbrkFunction · 0.85
zmallocFunction · 0.85
memmapcharsFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected