summary refs log tree commit diff
path: root/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'service.c')
-rw-r--r--service.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/service.c b/service.c
index 9a3b157..39ce60e 100644
--- a/service.c
+++ b/service.c
@@ -212,15 +212,21 @@ void serviceStart(struct Service *service) {
 		);
 		assert(n > 0);
 		len += n;
+		if (len >= sizeof(command)) errx(ExitNoExec, "command truncated");
 	}
-	snprintf(&command[len], sizeof(command) - len, "exec %s", service->command);
+	int n = snprintf(
+		&command[len], sizeof(command) - len, "exec %s", service->command
+	);
+	assert(n > 0);
+	len += n;
+	if (len >= sizeof(command)) errx(ExitNoExec, "command truncated");
 
 	execle(
 		_PATH_BSHELL,
 		_PATH_BSHELL, "-c", command, service->name, NULL,
 		serviceEnviron
 	);
-	err(ExitNotFound, "%s", _PATH_BSHELL);
+	err(ExitNoExec, "%s", _PATH_BSHELL);
 }
 
 void serviceSignal(struct Service *service, int signal) {