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: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
Paul Moore 2006-10-11 19:10:49 -04:00 committed by David S. Miller
parent bf0edf3929
commit ea614d7f4f
1 changed files with 2 additions and 2 deletions

View File

@ -832,8 +832,8 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def,
switch (doi_def->type) {
case CIPSO_V4_MAP_PASS:
net_spot_max = host_cat_len - 1;
while (net_spot_max > 0 && host_cat[net_spot_max] == 0)
net_spot_max = host_cat_len;
while (net_spot_max > 0 && host_cat[net_spot_max - 1] == 0)
net_spot_max--;
if (net_spot_max > net_cat_len)
return -EINVAL;