Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2012 01:51:08 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r233152 - stable/9/lib/libutil
Message-ID:  <201203190151.q2J1p8PF045431@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Mar 19 01:51:08 2012
New Revision: 233152
URL: http://svn.freebsd.org/changeset/base/233152

Log:
  MFC r231306:
  	Fix NULL ptr dereference in setusercontext if pwd is null,
  	LOGIN_SETPRIORITY is set, and setting the priority (rtprio or
  	setpriority) fails.
  
  PR:		kern/164238
  Approved by:	cperciva

Modified:
  stable/9/lib/libutil/login_class.c
Directory Properties:
  stable/9/lib/libutil/   (props changed)

Modified: stable/9/lib/libutil/login_class.c
==============================================================================
--- stable/9/lib/libutil/login_class.c	Mon Mar 19 01:33:24 2012	(r233151)
+++ stable/9/lib/libutil/login_class.c	Mon Mar 19 01:51:08 2012	(r233152)
@@ -452,18 +452,21 @@ setusercontext(login_cap_t *lc, const st
 	    p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
 	    if (rtprio(RTP_SET, 0, &rtp))
 		syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
-		    pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+		    pwd ? pwd->pw_name : "-",
+		    lc ? lc->lc_class : LOGIN_DEFCLASS);
 	} else if (p < PRIO_MIN) {
 	    rtp.type = RTP_PRIO_REALTIME;
 	    rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
 	    p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
 	    if (rtprio(RTP_SET, 0, &rtp))
 		syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
-		    pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+		    pwd ? pwd->pw_name : "-",
+		    lc ? lc->lc_class : LOGIN_DEFCLASS);
 	} else {
 	    if (setpriority(PRIO_PROCESS, 0, (int)p) != 0)
 		syslog(LOG_WARNING, "setpriority '%s' (%s): %m",
-		    pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+		    pwd ? pwd->pw_name : "-",
+		    lc ? lc->lc_class : LOGIN_DEFCLASS);
 	}
     }
 



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