Skip to content

Commit 5adb635

Browse files
committed
Merge tag 'selinux-pr-20250618' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore: "A small SELinux patch to resolve a UBSAN warning in the xfrm/labeled-IPsec code" * tag 'selinux-pr-20250618' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: fix selinux_xfrm_alloc_user() to set correct ctx_len
2 parents 5da3ff1 + 86c8db8 commit 5adb635

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/xfrm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp,
9494

9595
ctx->ctx_doi = XFRM_SC_DOI_LSM;
9696
ctx->ctx_alg = XFRM_SC_ALG_SELINUX;
97-
ctx->ctx_len = str_len;
97+
ctx->ctx_len = str_len + 1;
9898
memcpy(ctx->ctx_str, &uctx[1], str_len);
9999
ctx->ctx_str[str_len] = '\0';
100100
rc = security_context_to_sid(ctx->ctx_str, str_len,

0 commit comments

Comments
 (0)