From: Victor Julien Date: Thu, 10 Aug 2023 08:08:37 +0000 (+0200) Subject: detect: fix path creation in Windows X-Git-Tag: suricata-7.0.1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04aee5f0995c6ba08d35ee5e363c4e0b9f82b5ca;p=thirdparty%2Fsuricata.git detect: fix path creation in Windows Fixes file loading for rule files and Lua scripts. Bug: #6095. --- diff --git a/src/detect-engine-loader.c b/src/detect-engine-loader.c index 5a5e79c099..3419eb8ab0 100644 --- a/src/detect-engine-loader.c +++ b/src/detect-engine-loader.c @@ -85,21 +85,9 @@ char *DetectLoadCompleteSigPath(const DetectEngineCtx *de_ctx, const char *sig_f /* Path not specified */ if (PathIsRelative(sig_file)) { if (defaultpath) { - SCLogDebug("Default path: %s", defaultpath); - size_t path_len = sizeof(char) * (strlen(defaultpath) + - strlen(sig_file) + 2); - path = SCMalloc(path_len); + path = PathMergeAlloc(defaultpath, sig_file); if (unlikely(path == NULL)) return NULL; - strlcpy(path, defaultpath, path_len); -#if defined OS_WIN32 || defined __CYGWIN__ - if (path[strlen(path) - 1] != '\\') - strlcat(path, "\\\\", path_len); -#else - if (path[strlen(path) - 1] != '/') - strlcat(path, "/", path_len); -#endif - strlcat(path, sig_file, path_len); } else { path = SCStrdup(sig_file); if (unlikely(path == NULL))