dtcm: Coverity 89265
authorPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 00:26:39 +0000 (01:26 +0100)
committerPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 00:26:39 +0000 (01:26 +0100)
cde/programs/dtcm/server/svcmain.c

index c917922c7a3e5fe8089ce743a5cd2175fe4e3dc8..8b9b27fa7ba8727c8a8a7c68ebeef6ca34a75d14 100644 (file)
@@ -327,14 +327,11 @@ lock_it(void)
        locker.l_len = 0;
 #endif /* SVR4 */
 
-       strcpy (buff, dir);
-       strcat (buff, "/.lock.");
-
        /* 
         * /var/spool might be mounted.  Use .lock.hostname to
         * prevent more than one cms running in each host.
         */
-       strcat(buff, _DtCmGetLocalHost());
+       snprintf(buff, sizeof(buff), "%s/.lock.%s", dir, _DtCmGetLocalHost());
 
        fd = open(buff, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (fd < 0)