[SECURITY] secmark: nul-terminate secdata
authorJames Morris <[email protected]>
Mon, 31 Jul 2006 03:46:38 +0000 (20:46 -0700)
committerDavid S. Miller <[email protected]>
Wed, 2 Aug 2006 20:38:23 +0000 (13:38 -0700)
commita280b89982f48e9a32c6410a37419b12ca88af6b
treebf9cf034ed75a492bf84a73b7be75d94f2782e50
parente795d092507d571d66f2ec98d3efdc7dd284bf80
[SECURITY] secmark: nul-terminate secdata

The patch below fixes a problem in the iptables SECMARK target, where
the user-supplied 'selctx' string may not be nul-terminated.

From initial analysis, it seems that the strlen() called from
selinux_string_to_sid() could run until it arbitrarily finds a zero,
and possibly cause a kernel oops before then.

The impact of this appears limited because the operation requires
CAP_NET_ADMIN, which is essentially always root.  Also, the module is
not yet in wide use.

Signed-off-by: James Morris <[email protected]>
Signed-off-by: Stephen Smalley <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/netfilter/xt_SECMARK.c