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. */
| 5582 | * free tmp if it is non-null on return. |
| 5583 | */ |
| 5584 | const char *getSafeInfoString(const char *s, size_t len, char **tmp) { |
| 5585 | *tmp = NULL; |
| 5586 | if (mempbrk(s, len, unsafe_info_chars,sizeof(unsafe_info_chars)-1) |
| 5587 | == NULL) return s; |
| 5588 | char *_new = *tmp = (char*)zmalloc(len + 1); |
| 5589 | memcpy(_new, s, len); |
| 5590 | _new[len] = '\0'; |
| 5591 | return memmapchars(_new, len, unsafe_info_chars, unsafe_info_chars_substs, |
| 5592 | sizeof(unsafe_info_chars)-1); |
| 5593 | } |
| 5594 | |
| 5595 | /* Create the string returned by the INFO command. This is decoupled |
| 5596 | * by the INFO command itself as we need to report the same information |
no test coverage detected