PERFORCE change 188985 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Feb 20 21:46:59 UTC 2011


http://p4web.freebsd.org/@@188985?ac=10

Change 188985 by trasz at trasz_victim on 2011/02/20 21:46:46

	Loginclass name must not be empty.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#31 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#31 (text+ko) ====

@@ -113,7 +113,7 @@
 {
 	struct loginclass *lc, *newlc;
 
-	if (strlen(name) > MAXLOGNAME - 1)
+	if (name[0] == '\0' || strlen(name) > MAXLOGNAME - 1)
 		return (NULL);
 
 	newlc = malloc(sizeof(*newlc), M_LOGINCLASS, M_ZERO | M_WAITOK);
@@ -198,9 +198,10 @@
 	if (error != 0)
 		return (error);
 
+	newlc = loginclass_find(lcname);
+	if (newlc == NULL)
+		return (EINVAL);
 	newcred = crget();
-	newlc = loginclass_find(lcname);
-	KASSERT(newlc != NULL, ("loginclass_find() failed"));
 
 	PROC_LOCK(p);
 	oldcred = crcopysafe(p, newcred);


More information about the p4-projects mailing list