Skip to content

Commit

Permalink
xfrm: Prepare for CRYPTO_MAX_ALG_NAME expansion
Browse files Browse the repository at this point in the history
This patch fixes the xfrm_user code to use the actual array size
rather than the hard-coded CRYPTO_MAX_ALG_NAME length.  This is
because the array size is fixed at 64 bytes while we want to increase
the in-kernel CRYPTO_MAX_ALG_NAME value.

Signed-off-by: Herbert Xu <[email protected]>
Acked-by: Alexander Sverdlin <[email protected]>
Tested-by: Alexander Sverdlin <[email protected]>
Acked-by: Steffen Klassert <[email protected]>
  • Loading branch information
herbertx committed Apr 10, 2017
1 parent 3f69cc6 commit 633439f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
return -EINVAL;
}

algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
return 0;
}

Expand All @@ -71,7 +71,7 @@ static int verify_auth_trunc(struct nlattr **attrs)
if (nla_len(rt) < xfrm_alg_auth_len(algp))
return -EINVAL;

algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
return 0;
}

Expand All @@ -87,7 +87,7 @@ static int verify_aead(struct nlattr **attrs)
if (nla_len(rt) < aead_len(algp))
return -EINVAL;

algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';
return 0;
}

Expand Down

0 comments on commit 633439f

Please sign in to comment.