cronie/Ensure-the-command-name-is-not-null-before-logging-i.patch

26 lines
760 B
Diff
Raw Normal View History

2020-07-23 18:31:35 +08:00
From 59063efa62fbb75bb75ad34a9e9c551b77284377 Mon Sep 17 00:00:00 2001
From: John Horne <john.horne@plymouth.ac.uk>
Date: Mon, 20 Apr 2020 20:16:29 +0100
Subject: [PATCH] Ensure the command name is not null before logging it.
---
src/do_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/do_command.c b/src/do_command.c
index 76939a1..d1594c6 100644
--- a/src/do_command.c
+++ b/src/do_command.c
@@ -592,7 +592,7 @@ static int child_process(entry * e, char **jobenv) {
if ((e->flags & DONT_LOG) == 0) {
char *x = mkprints((u_char *) e->cmd, strlen(e->cmd));
- log_it(usernm, getpid(), "CMDEND", x, 0);
+ log_it(usernm, getpid(), "CMDEND", x ? x : "Unknown command" , 0);
free(x);
}
return OK_EXIT;
--
1.8.3.1