351470: setuid root programs linked with NSPR allow elevation of privilege. r=nelson, sr=wtc

This commit is contained in:
alexei.volkov.bugs%sun.com 2006-09-07 23:33:39 +00:00
parent 8a4c1438e6
commit c365bb7dc0
2 changed files with 10 additions and 0 deletions

View File

@ -277,6 +277,14 @@ void _PR_InitFdCache(void)
if (NULL != low) _pr_fd_cache.limit_low = atoi(low); if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
if (NULL != high) _pr_fd_cache.limit_high = atoi(high); if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
if (_pr_fd_cache.limit_low < 0)
_pr_fd_cache.limit_low = 0;
if (_pr_fd_cache.limit_low > FD_SETSIZE)
_pr_fd_cache.limit_low = FD_SETSIZE;
if (_pr_fd_cache.limit_high > FD_SETSIZE)
_pr_fd_cache.limit_high = FD_SETSIZE;
if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low) if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low)
_pr_fd_cache.limit_high = _pr_fd_cache.limit_low; _pr_fd_cache.limit_high = _pr_fd_cache.limit_low;

View File

@ -120,6 +120,8 @@ int index;
if (num_atomic_locks > MAX_ATOMIC_LOCKS) if (num_atomic_locks > MAX_ATOMIC_LOCKS)
num_atomic_locks = MAX_ATOMIC_LOCKS; num_atomic_locks = MAX_ATOMIC_LOCKS;
else if (num_atomic_locks < 1)
num_atomic_locks = 1;
else { else {
num_atomic_locks = PR_FloorLog2(num_atomic_locks); num_atomic_locks = PR_FloorLog2(num_atomic_locks);
num_atomic_locks = 1L << num_atomic_locks; num_atomic_locks = 1L << num_atomic_locks;