From: Peter Howkins Date: Wed, 4 Jul 2018 00:26:39 +0000 (+0100) Subject: dtcm: Coverity 89265 X-Git-Tag: 2.3.0a~216 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4ee5f3d3cf90b76135cb6d410c0dde5db0ef6f08;p=oweals%2Fcde.git dtcm: Coverity 89265 --- diff --git a/cde/programs/dtcm/server/svcmain.c b/cde/programs/dtcm/server/svcmain.c index c917922c..8b9b27fa 100644 --- a/cde/programs/dtcm/server/svcmain.c +++ b/cde/programs/dtcm/server/svcmain.c @@ -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)