In C, how to redact or hide a substring such as "password" in a longer string such as "Hello password" replacing it with an arbitrary character such as '*' (repeated as necessary)?
Here is the intended usage for such a function, called redact:
#include <stdio.h>
int main()
{
    char s[] = "Hello password";
    printf("Input:\t\"%s\"\n", s);
    redact(s, "password", '*');
    printf("Output:\t\"%s\"\n", s);
}
Expected results:
Input: "Hello password"
Output: "Hello ********"
There are more general solutions involving replacement strings of arbitrary length and additional memory allocation that would not be as efficient for this special case: