Don't modify the stack limit if it is >= SUDO_STACK_MIN.

This commit is contained in:
Todd C. Miller
2022-01-11 13:21:32 -07:00
parent 5fdaa48228
commit 1c95ab8852

View File

@@ -195,7 +195,7 @@ static struct saved_limit {
false, /* saved */ false, /* saved */
false, /* policy */ false, /* policy */
false, /* preserve */ false, /* preserve */
RLIM_INFINITY, /* minlimit */ SUDO_STACK_MIN, /* minlimit */
&stack_fallback, &stack_fallback,
{ SUDO_STACK_MIN, RLIM_INFINITY } { SUDO_STACK_MIN, RLIM_INFINITY }
} }
@@ -347,9 +347,9 @@ unlimit_sudo(void)
if (lim->oldlimit.rlim_cur >= lim->minlimit) if (lim->oldlimit.rlim_cur >= lim->minlimit)
lim->override = false; lim->override = false;
} }
if (!lim->override) if (!lim->override)
continue; continue;
if (lim->newlimit.rlim_cur != RLIM_INFINITY) { if (lim->newlimit.rlim_cur != RLIM_INFINITY) {
/* Don't reduce the soft resource limit. */ /* Don't reduce the soft resource limit. */
if (lim->oldlimit.rlim_cur == RLIM_INFINITY || if (lim->oldlimit.rlim_cur == RLIM_INFINITY ||