svn commit: r233152 - stable/9/lib/libutil
Eitan Adler
eadler at FreeBSD.org
Mon Mar 19 01:51:09 UTC 2012
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);
}
}
More information about the svn-src-stable-9
mailing list