From b9a8951cf86214a3dcb430ae0d34e8d5dc1adb11 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 10 Jul 2019 20:44:35 +0100 Subject: Ensure log filenames are safe for writing. --- functions.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 8bbc213..938b8b1 100644 --- a/functions.c +++ b/functions.c @@ -1253,3 +1253,12 @@ int getclientcodetime(char *code, struct clientcodes *clientcodes) { // If we got here, the code was never found return 0; } + +// Replace any instances of "find" with "replace" in the string "str" +void replacechar(char *str, char find, char replace) { + for (size_t i = 0; i < strlen(str); i++) { + if (str[i] == find) { + str[i] = replace; + } + } +} -- cgit v1.2.3