]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - security/selinux/xfrm.c
Merge branch 'fixes-2.6.23' of git://git.kernel.org/pub/scm/linux/kernel/git/galak...
[mv-sheeva.git] / security / selinux / xfrm.c
index bd8d1ef40a905e9fb532d8be84c9082576bc5bfd..ba715f40b658e4dfd63a05024ab566bcb81daf9c 100644 (file)
@@ -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)
@@ -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);