svn commit: r233154 - stable/7/lib/libutil
Eitan Adler
eadler at FreeBSD.org
Mon Mar 19 01:52:10 UTC 2012
Author: eadler
Date: Mon Mar 19 01:52:09 2012
New Revision: 233154
URL: http://svn.freebsd.org/changeset/base/233154
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/7/lib/libutil/login_class.c
Directory Properties:
stable/7/lib/libutil/ (props changed)
Modified: stable/7/lib/libutil/login_class.c
==============================================================================
--- stable/7/lib/libutil/login_class.c Mon Mar 19 01:51:53 2012 (r233153)
+++ stable/7/lib/libutil/login_class.c Mon Mar 19 01:52:09 2012 (r233154)
@@ -448,18 +448,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);
}
}
More information about the svn-src-stable-7
mailing list