From: Yu Watanabe Date: Fri, 28 Aug 2020 03:53:08 +0000 (+0900) Subject: network: do not reallocate buffer X-Git-Tag: v247-rc1~298^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d6282d1205be45768460ccc4ba2ae5d8397dbde;p=thirdparty%2Fsystemd.git network: do not reallocate buffer --- diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 4befc2f4982..e7e89db97e9 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -1340,17 +1340,21 @@ int routing_policy_load_rules(const char *state_file, Set **rules) { return r; for (;;) { - _cleanup_free_ char *word = NULL, *a = NULL, *b = NULL; + _cleanup_free_ char *a = NULL; + char *b; - r = extract_first_word(&p, &word, NULL, 0); + r = extract_first_word(&p, &a, NULL, 0); if (r < 0) return r; if (r == 0) break; - r = split_pair(word, "=", &a, &b); - if (r < 0) + b = strchr(a, '='); + if (!b) { + log_warning_errno(r, "Failed to parse RPDB rule, ignoring: %s", a); continue; + } + *b++ = '\0'; if (STR_IN_SET(a, "from", "to")) { union in_addr_union *buffer;