mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 14:23:49 +01:00
netfilter: x_physdev: reject empty or not-nul terminated device names
Reject names that lack a \0 character and reject the empty string as well. iptables allows this but it fails to re-parse iptables-save output that contain such rules. Signed-off-by: Florian Westphal <[email protected]>
This commit is contained in:
1 parent
8d7de5477e
commit
8df772afc9
1 file changed
+22
@@ -107,6 +107,28 @@ static int physdev_mt_check(const struct xt_mtchk_param *par)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#define X(memb) strnlen(info->memb, sizeof(info->memb)) >= sizeof(info->memb)
|
||||
if (info->bitmask & XT_PHYSDEV_OP_IN) {
|
||||
if (info->physindev[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (X(physindev))
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
|
||||
if (info->bitmask & XT_PHYSDEV_OP_OUT) {
|
||||
if (info->physoutdev[0] == '\0')
|
||||
return -EINVAL;
|
||||
|
||||
if (X(physoutdev))
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
|
||||
if (X(in_mask))
|
||||
return -ENAMETOOLONG;
|
||||
if (X(out_mask))
|
||||
return -ENAMETOOLONG;
|
||||
#undef X
|
||||
|
||||
if (!brnf_probed) {
|
||||
brnf_probed = true;
|
||||
request_module("br_netfilter");
|
||||
|
||||
Reference in new issue
Block a user