diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-25 14:28:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-25 14:28:19 -0400 |
commit | 80492cc797ea15572de8eac766cbf606626ee338 (patch) | |
tree | 415c2bdddfed5645aaa93c06b08cceb6403e9595 | |
parent | a4fb2122f1fc4a22bd6a5b8a195b952c2d31c54d (diff) | |
parent | 910949a66839ff5f59fede5b7cb68ecf1453e22c (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
-rw-r--r-- | security/selinux/xfrm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index bd8d1ef40a90..ba715f40b658 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
@@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp, | |||
216 | return -ENOMEM; | 216 | return -ENOMEM; |
217 | 217 | ||
218 | *ctxp = ctx = kmalloc(sizeof(*ctx) + | 218 | *ctxp = ctx = kmalloc(sizeof(*ctx) + |
219 | uctx->ctx_len, | 219 | uctx->ctx_len + 1, |
220 | GFP_KERNEL); | 220 | GFP_KERNEL); |
221 | 221 | ||
222 | if (!ctx) | 222 | if (!ctx) |
@@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp, | |||
229 | memcpy(ctx->ctx_str, | 229 | memcpy(ctx->ctx_str, |
230 | uctx+1, | 230 | uctx+1, |
231 | ctx->ctx_len); | 231 | ctx->ctx_len); |
232 | ctx->ctx_str[ctx->ctx_len] = 0; | ||
232 | rc = security_context_to_sid(ctx->ctx_str, | 233 | rc = security_context_to_sid(ctx->ctx_str, |
233 | ctx->ctx_len, | 234 | ctx->ctx_len, |
234 | &ctx->ctx_sid); | 235 | &ctx->ctx_sid); |