]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not ignore OOM error in wireguard_decode_key_and_warn()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 10 Sep 2020 04:38:31 +0000 (13:38 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 10 Sep 2020 04:59:04 +0000 (13:59 +0900)
src/network/netdev/wireguard.c

index 5a6eb80d34435608a4a6af11d8e73bdb811c6dbc..314fceb7154c087319de5e4fc4dfa712ea139cd3 100644 (file)
@@ -492,6 +492,8 @@ static int wireguard_decode_key_and_warn(
                 (void) warn_file_is_world_accessible(filename, NULL, unit, line);
 
         r = unbase64mem_full(rvalue, strlen(rvalue), true, &key, &len);
+        if (r == -ENOMEM)
+                return log_oom();
         if (r < 0) {
                 log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to decode wireguard key provided by %s=, ignoring assignment: %m", lvalue);
@@ -526,8 +528,7 @@ int config_parse_wireguard_private_key(
         w = WIREGUARD(data);
         assert(w);
 
-        (void) wireguard_decode_key_and_warn(rvalue, w->private_key, unit, filename, line, lvalue);
-        return 0;
+        return wireguard_decode_key_and_warn(rvalue, w->private_key, unit, filename, line, lvalue);
 }
 
 int config_parse_wireguard_private_key_file(