nsresource: fix buffer overrun reported by ASAN

This came up when running systemd-vmspawn with ASAN to fix another bug
and thus I had to fix this overrun here first: The dispatch tables were
missing the terminator, add it.

(cherry picked from commit 41cf689121)
(cherry picked from commit 30b2a4d821)
This commit is contained in:
Kai Lüke
2026-04-25 01:42:36 +09:00
committed by Luca Boccassi
parent 121622432d
commit 669691ae54

View File

@@ -352,6 +352,7 @@ int nsresource_add_netif_veth(
static const sd_json_dispatch_field dispatch_table[] = {
{ "hostInterfaceName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(InterfaceParams, host_interface_name), SD_JSON_MANDATORY },
{ "namespaceInterfaceName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(InterfaceParams, namespace_interface_name), SD_JSON_MANDATORY },
{}
};
_cleanup_(interface_params_done) InterfaceParams p = {};
@@ -416,6 +417,7 @@ int nsresource_add_netif_tap(
static const sd_json_dispatch_field dispatch_table[] = {
{ "hostInterfaceName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(InterfaceParams, host_interface_name), SD_JSON_MANDATORY },
{ "interfaceFileDescriptor", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint, offsetof(InterfaceParams, interface_fd_index), SD_JSON_MANDATORY },
{}
};
_cleanup_(interface_params_done) InterfaceParams p = {};