[systemd-devel] [PATCH 5/5] coredumpctl: null check before dereferencing

Michal Sekletar msekleta at redhat.com
Fri Oct 26 05:17:48 PDT 2012


---
 src/journal/coredumpctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index aa946ae..800e43f 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -220,9 +220,10 @@ static int retrieve(sd_journal *j, const char *name, const char **var) {
 
         field = strlen(name) + 1; // name + "="
         assert(len >= field);
+        assert(var);
 
         *var = strndup((const char*)data + field, len - field);
-        if (!var)
+        if (!*var)
                 return log_oom();
 
         return 0;
-- 
1.7.11.7



More information about the systemd-devel mailing list