core: fix member access within null pointer
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 11 Oct 2018 19:24:27 +0000 (04:24 +0900)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Oct 2018 20:23:39 +0000 (22:23 +0200)
config_parse_tasks_max() is also used for parsing system.conf or
user.conf. In that case, userdata is NULL.

Fixes #10362.

src/core/load-fragment.c

index 9f24b47..f96775e 100644 (file)
@@ -3093,7 +3093,7 @@ int config_parse_tasks_max(
         int r;
 
         if (isempty(rvalue)) {
-                *tasks_max = u->manager->default_tasks_max;
+                *tasks_max = u ? u->manager->default_tasks_max : UINT64_MAX;
                 return 0;
         }