[systemd-commits] 2 commits - src/journal

Thomas H.P. Andersen phomes at kemper.freedesktop.org
Thu Jun 26 15:18:13 PDT 2014


 src/journal/coredump.c    |   10 +++++-----
 src/journal/coredumpctl.c |    6 ++++--
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit d0c8806d4abf863baae1e3f796db674d57a67686
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Fri Jun 27 00:17:22 2014 +0200

    coredumpctl: fix potential deref of null pointer

diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 5a6c897..2158d73 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -601,8 +601,10 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
         }
 
         if (filename && !endswith(filename, ".xz")) {
-                *path = filename;
-                filename = NULL;
+                if (path) {
+                        *path = filename;
+                        filename = NULL;
+                }
 
                 return 0;
         } else {

commit 7849c2acd479278d54851694762b967610912d02
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Fri Jun 27 00:07:39 2014 +0200

    coredump: make sure variable is set if uncompressed
    
    reorder the code so the fstat is done before we can jump to
    uncompressed

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 5e93091..ab8fd2c 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -345,16 +345,16 @@ static int save_external_coredump(const char *info[_INFO_LEN],
                 goto fail;
         }
 
-        if (lseek(fd, 0, SEEK_SET) == (off_t) -1) {
-                log_error("Failed to seek on %s: %m", tmp);
-                goto uncompressed;
-        }
-
         if (fstat(fd, &st) < 0) {
                 log_error("Failed to fstat coredump %s: %m", tmp);
                 goto fail;
         }
 
+        if (lseek(fd, 0, SEEK_SET) == (off_t) -1) {
+                log_error("Failed to seek on %s: %m", tmp);
+                goto uncompressed;
+        }
+
 #ifdef HAVE_XZ
         /* If we will remove the coredump anyway, do not compress. */
         if (maybe_remove_external_coredump(NULL, st.st_size) == 0



More information about the systemd-commits mailing list