From 590350ba8e7ba4c8fd25ad0903c1e76dd70c15e6 Mon Sep 17 00:00:00 2001
From: obarun <eric@obarun.org>
Date: Sun, 21 May 2023 21:01:18 +1100
Subject: [PATCH] be sure to have the real length of the directory to copy

---
 src/lib66/module/parse_module.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lib66/module/parse_module.c b/src/lib66/module/parse_module.c
index 63fb5c3e..c084430d 100644
--- a/src/lib66/module/parse_module.c
+++ b/src/lib66/module/parse_module.c
@@ -123,11 +123,15 @@ void parse_module(resolve_service_t *res, resolve_service_t *ares, unsigned int
 
         auto_strings(copy, SS_SERVICE_ADMDIR, name) ;
 
+        copylen = strlen(copy) ;
+
     } else {
 
         if (!set_ownerhome_stack(copy))
             log_dieusys(LOG_EXIT_SYS, "unable to find the home directory of the user") ;
 
+        copylen = strlen(copy) ;
+
         auto_strings(copy + copylen, SS_SERVICE_USERDIR, name) ;
     }
 
@@ -167,8 +171,6 @@ void parse_module(resolve_service_t *res, resolve_service_t *ares, unsigned int
             log_dieusys(LOG_EXIT_SYS,"copy: ", dirname, " to: ", copy) ;
     }
 
-    copylen = strlen(copy) ;
-
     auto_strings(copy + copylen, "/", ainsta) ;
 
     /** remove the original service frontend file inside the copied directory
-- 
GitLab