svn commit: r231306 - head/lib/libutil
Eitan Adler
eadler at FreeBSD.org
Thu Feb 9 21:06:47 UTC 2012
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 at 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);
}
}
More information about the svn-src-all
mailing list