提交 ea614d7f 编写于 作者: P Paul Moore 提交者: David S. Miller

NetLabel: the CIPSOv4 passthrough mapping does not pass categories correctly

The CIPSO passthrough mapping had a problem when sending categories which
would cause no or incorrect categories to be sent on the wire with a packet.
This patch fixes the problem which was a simple off-by-one bug.
Signed-off-by: NPaul Moore <paul.moore@hp.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 bf0edf39
...@@ -832,8 +832,8 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def, ...@@ -832,8 +832,8 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def,
switch (doi_def->type) { switch (doi_def->type) {
case CIPSO_V4_MAP_PASS: case CIPSO_V4_MAP_PASS:
net_spot_max = host_cat_len - 1; net_spot_max = host_cat_len;
while (net_spot_max > 0 && host_cat[net_spot_max] == 0) while (net_spot_max > 0 && host_cat[net_spot_max - 1] == 0)
net_spot_max--; net_spot_max--;
if (net_spot_max > net_cat_len) if (net_spot_max > net_cat_len)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册