[systemd-devel] [PATCH 2/5] [use after free] pattern is already freed, so do not dereference it in the error print

philippedeswert at gmail.com philippedeswert at gmail.com
Wed Sep 10 02:20:39 PDT 2014


From: Philippe De Swert <philippedeswert at gmail.com>

In case set_consume goes wrong, the pattern name has already been
freed. So we do not try to print it in the logs, assuming the pattern
addition print will be printed just before the failure anyway. Found
with coverity. Fixes: CID#1237798

Signed-off-by: Philippe De Swert <philippedeswert at gmail.com>
---
 src/journal/coredumpctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index f5cf85a..4b12ec3 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -110,8 +110,8 @@ static int add_match(Set *set, const char *match) {
         log_debug("Adding pattern: %s", pattern);
         r = set_consume(set, pattern);
         if (r < 0) {
-                log_error("Failed to add pattern '%s': %s",
-                          pattern, strerror(-r));
+                log_error("Failed to add pattern : %s",
+                          strerror(-r));
                 goto fail;
         }
 
-- 
1.8.3.2



More information about the systemd-devel mailing list