All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
@ 2007-07-24 14:53 Venkat Yekkirala
  2007-07-24 16:22 ` Joy Latten
  2007-07-24 19:20 ` Stephen Smalley
  0 siblings, 2 replies; 5+ messages in thread
From: Venkat Yekkirala @ 2007-07-24 14:53 UTC (permalink / raw)
  To: selinux; +Cc: jmorris, sds, latten

xfrm_audit_log() expects the context string to be null-terminated
which currently doesn't happen with user-supplied contexts.

Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
---
 security/selinux/xfrm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:43:23.000000000 -0500
+++ selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:44:11.000000000 -0500
@@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
 		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(st
 	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);

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-24 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 14:53 [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string Venkat Yekkirala
2007-07-24 16:22 ` Joy Latten
2007-07-24 16:45   ` Joy Latten
2007-07-24 19:20 ` Stephen Smalley
2007-07-24 20:44   ` James Morris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.