aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_echo/pam_echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_echo/pam_echo.c')
-rw-r--r--modules/pam_echo/pam_echo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/pam_echo/pam_echo.c b/modules/pam_echo/pam_echo.c
index 181aeb4c..d05597a2 100644
--- a/modules/pam_echo/pam_echo.c
+++ b/modules/pam_echo/pam_echo.c
@@ -41,6 +41,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
+#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
@@ -182,6 +183,12 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv)
return PAM_IGNORE;
}
+ if ((uintmax_t) st.st_size >= (uintmax_t) SIZE_MAX)
+ {
+ close (fd);
+ return PAM_BUF_ERR;
+ }
+
mtmp = malloc (st.st_size + 1);
if (!mtmp)
{