namespace-util: explicitly specify namespace_info[]'s size

We do this already in all string lookup tables. This way
it's guaranteed that iterators which ends with _NAMESPACE_TYPE_MAX
wouldn't overrun the array.
This commit is contained in:
Mike Yuan
2024-07-23 19:30:54 +02:00
parent 7973f33e81
commit 30957ced45
+1 -1
View File
@@ -17,7 +17,7 @@
#include "stdio-util.h"
#include "user-util.h"
const struct namespace_info namespace_info[] = {
const struct namespace_info namespace_info[_NAMESPACE_TYPE_MAX + 1] = {
[NAMESPACE_CGROUP] = { "cgroup", "ns/cgroup", CLONE_NEWCGROUP, },
[NAMESPACE_IPC] = { "ipc", "ns/ipc", CLONE_NEWIPC, },
[NAMESPACE_NET] = { "net", "ns/net", CLONE_NEWNET, },