Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2012 01:51:53 +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-8@freebsd.org
Subject:   svn commit: r233153 - stable/8/lib/libutil
Message-ID:  <201203190151.q2J1pr3s045481@svn.freebsd.org>

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

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/8/lib/libutil/login_class.c
Directory Properties:
  stable/8/lib/libutil/   (props changed)

Modified: stable/8/lib/libutil/login_class.c
==============================================================================
--- stable/8/lib/libutil/login_class.c	Mon Mar 19 01:51:08 2012	(r233152)
+++ stable/8/lib/libutil/login_class.c	Mon Mar 19 01:51:53 2012	(r233153)
@@ -450,18 +450,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.q2J1pr3s045481>