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. */
| 4616 | * free tmp if it is non-null on return. |
| 4617 | */ |
| 4618 | const 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 |
no test coverage detected