mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
network: fix memleak
set_put() does not return -EEXIST. Fixes #12995 and oss-fuzz#15678.
This commit is contained in:
committed by
Lennart Poettering
parent
f34635bcda
commit
e4443f9bfc
@@ -764,6 +764,9 @@ int config_parse_ndisc_black_listed_prefix(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (set_contains(network->ndisc_black_listed_prefix, &ip.in6))
|
||||
continue;
|
||||
|
||||
r = set_ensure_allocated(&network->ndisc_black_listed_prefix, &in6_addr_hash_ops);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
@@ -774,12 +777,8 @@ int config_parse_ndisc_black_listed_prefix(
|
||||
|
||||
r = set_put(network->ndisc_black_listed_prefix, a);
|
||||
if (r < 0) {
|
||||
if (r == -EEXIST)
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"NDISC black listed prefixs is duplicated, ignoring assignment: %s", n);
|
||||
else
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"Failed to store NDISC black listed prefix '%s', ignoring assignment: %m", n);
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"Failed to store NDISC black listed prefix '%s', ignoring assignment: %m", n);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
2
test/fuzz/fuzz-network-parser/oss-fuzz-15678
Normal file
2
test/fuzz/fuzz-network-parser/oss-fuzz-15678
Normal file
@@ -0,0 +1,2 @@
|
||||
[IPv6AcceptRA]
|
||||
BlackList=70:: 70::
|
||||
Reference in New Issue
Block a user