Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jmorris/selinux-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
  SELinux: null-terminate context string in selinux_xfrm_sec_ctx_alloc
  • Loading branch information
Linus Torvalds committed Jul 25, 2007
2 parents a4fb212 + 910949a commit 80492cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion security/selinux/xfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp,
return -ENOMEM;

*ctxp = ctx = kmalloc(sizeof(*ctx) +
uctx->ctx_len,
uctx->ctx_len + 1,
GFP_KERNEL);

if (!ctx)
Expand All @@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp,
memcpy(ctx->ctx_str,
uctx+1,
ctx->ctx_len);
ctx->ctx_str[ctx->ctx_len] = 0;
rc = security_context_to_sid(ctx->ctx_str,
ctx->ctx_len,
&ctx->ctx_sid);
Expand Down

0 comments on commit 80492cc

Please sign in to comment.