summaryrefslogtreecommitdiff
path: root/modules/pam_limits/pam_limits.c
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@thkukuk.de>2007-06-22 23:30:36 +0000
committerThorsten Kukuk <kukuk@thkukuk.de>2007-06-22 23:30:36 +0000
commitcc4a814d318d7926bb73dec21c99f46f6ef31d3a (patch)
treefb740551d28e667a5adb8e5fa88e53a4795fedba /modules/pam_limits/pam_limits.c
parent4b951f0e7dea276cafa87cb344847ff1ae44fb9c (diff)
Relevant BUGIDs:
Purpose of commit: bugfix Commit summary: --------------- 2007-06-22 Thorsten Kukuk <kukuk@thkukuk.de> * modules/pam_loginuid/pam_loginuid.c (set_loginuid): Print better error message if /proc/self/loginuid cannot be opened. * modules/pam_limits/pam_limits.c (process_limit): Check for variable overflow after multiplication [bnc#283001].
Diffstat (limited to 'modules/pam_limits/pam_limits.c')
-rw-r--r--modules/pam_limits/pam_limits.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index f9a91164..bf6f09df 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -374,8 +374,13 @@ process_limit (const pam_handle_t *pamh, int source, const char *lim_type,
switch(limit_item) {
case RLIMIT_CPU:
- if (rlimit_value != RLIM_INFINITY)
- rlimit_value *= 60;
+ if (rlimit_value != RLIM_INFINITY)
+ {
+ if (rlimit_value >= RLIM_INFINITY/60)
+ rlimit_value = RLIM_INFINITY;
+ else
+ rlimit_value *= 60;
+ }
break;
case RLIMIT_FSIZE:
case RLIMIT_DATA:
@@ -385,7 +390,12 @@ process_limit (const pam_handle_t *pamh, int source, const char *lim_type,
case RLIMIT_MEMLOCK:
case RLIMIT_AS:
if (rlimit_value != RLIM_INFINITY)
- rlimit_value *= 1024;
+ {
+ if (rlimit_value >= RLIM_INFINITY/1024)
+ rlimit_value = RLIM_INFINITY;
+ else
+ rlimit_value *= 1024;
+ }
break;
#ifdef RLIMIT_NICE
case RLIMIT_NICE:
@@ -674,7 +684,7 @@ pam_sm_open_session (pam_handle_t *pamh, int flags UNUSED,
out:
globfree(&globbuf);
- if (retval != PAM_SUCCESS)
+ if (retval != PAM_SUCCESS)
{
pam_syslog(pamh, LOG_WARNING, "error parsing the configuration file: '%s' ",CONF_FILE);
return retval;