Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2011 21:46:58 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 188985 for review
Message-ID:  <201102202146.p1KLkw82098175@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@188985?ac=10

Change 188985 by trasz@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102202146.p1KLkw82098175>