From d063d8b431ad025f753d101a211ea8ddf742fd64 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 17 May 2016 11:23:16 -0400 Subject: Check for too long lines --- src/pam_radius_auth.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/pam_radius_auth.c') diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c index 5a60fa0..e9b3034 100644 --- a/src/pam_radius_auth.c +++ b/src/pam_radius_auth.c @@ -619,17 +619,22 @@ static int initialize(radius_conf_t *conf, int accounting) p = buffer; /* - * Skip blank lines and whitespace + * Skip whitespace */ - while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) { - p++; - } + while ((*p == ' ') || (*p == '\t')) p++; /* - * Nothing, or just a comment. Ignore the line. + * Skip blank lines and comments. */ - if ((!*p) || (*p == '#')) { - continue; + if ((*p == '\r') || (*p == '\n') || (*p == '#')) continue; + + /* + * Error out if the text is too long. + */ + if (!*p) { + _pam_log(LOG_ERR, "ERROR reading %s, line %d: Line too long\n", + conf_file, line); + break; } timeout = 3; -- cgit v1.2.3