From 735f7b2c859d08042e558a77ac6db79cc2300743 Mon Sep 17 00:00:00 2001 From: Borja Arroba Date: Thu, 28 Jun 2018 13:09:39 +0200 Subject: [PATCH] Prevent the user from inserting forward slashes in the Windows path --- src/config/syscheck-config.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config/syscheck-config.c b/src/config/syscheck-config.c index 32c13aab6a5..f11b46cb8a4 100644 --- a/src/config/syscheck-config.c +++ b/src/config/syscheck-config.c @@ -38,6 +38,17 @@ int dump_syscheck_entry(syscheck_config *syscheck, const char *entry, int vals, } else { +#ifdef WIN32 + char *ptfile; + /* Change forward slashes to backslashes on entry */ + ptfile = strchr(entry, '/'); + while (ptfile) { + *ptfile = '\\'; + ptfile++; + + ptfile = strchr(ptfile, '/'); + } +#endif if (syscheck->dir == NULL) { os_calloc(2, sizeof(char *), syscheck->dir); syscheck->dir[pl + 1] = NULL;