initctl: fix use of possibly unterminated string, found by Coverity

No point in using rq.data, which could have been modified, instead use
the input argument to the function in the error message.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-03-05 10:51:25 +01:00
parent 5b9d99011b
commit 07a364e570
+1 -1
View File
@@ -208,7 +208,7 @@ static int do_startstop(int cmd, char *arg)
strlcpy(rq.data, arg, sizeof(rq.data));
if (client_send(&rq, sizeof(rq))) {
fprintf(stderr, "No such task or service(s): %s\n\n", rq.data);
fprintf(stderr, "No such task or service(s): %s\n\n", arg);
fprintf(stderr, "Usage: initctl %s <NAME>[:ID]\n",
cmd == INIT_CMD_START_SVC ? "start" :
(cmd == INIT_CMD_STOP_SVC ? "stop" : "restart"));