Date: Thu, 9 Feb 2012 21:06:47 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r231306 - head/lib/libutil Message-ID: <201202092106.q19L6l7I030729@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Thu Feb 9 21:06:47 2012 New Revision: 231306 URL: http://svn.freebsd.org/changeset/base/231306 Log: 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 Submitted by: Alexander Wittig <alexander@wittig.name> Reviewed by: des Approved by: cperciva MFC after: 1 month Modified: head/lib/libutil/login_class.c Modified: head/lib/libutil/login_class.c ============================================================================== --- head/lib/libutil/login_class.c Thu Feb 9 20:57:36 2012 (r231305) +++ head/lib/libutil/login_class.c Thu Feb 9 21:06:47 2012 (r231306) @@ -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?201202092106.q19L6l7I030729>