patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / security / selinux / ss / services.c
index 7d0fedf..21ab4c9 100644 (file)
@@ -532,6 +532,11 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
        if (rc)
                goto out_unlock;
 
+       if ((p - scontext2) < scontext_len) {
+               rc = -EINVAL;
+               goto out_unlock;
+       }
+
        /* Check the validity of the new context. */
        if (!policydb_context_isvalid(&policydb, &context)) {
                rc = -EINVAL;