From b6b00dd55e035bfbe311a527b567962ffa77ee43 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 26 Jun 2024 18:18:37 +0200 Subject: Merging upstream version 1:4.15.2. Signed-off-by: Daniel Baumann --- src/suauth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/suauth.c') diff --git a/src/suauth.c b/src/suauth.c index 2641d33..4d63190 100644 --- a/src/suauth.c +++ b/src/suauth.c @@ -68,8 +68,9 @@ int check_su_auth (const char *actual_id, while (fgets (temp, sizeof (temp), authfile_fd) != NULL) { lines++; + endline = strlen(temp) - 1; - if (temp[endline = strlen (temp) - 1] != '\n') { + if (temp[0] == '\0' || temp[endline] != '\n') { SYSLOG ((LOG_ERR, "%s, line %d: line too long or missing newline", SUAUTHFILE, lines)); @@ -91,9 +92,9 @@ int check_su_auth (const char *actual_id, continue; } if (!(to_users = strtok (temp + posn, field)) - || !(from_users = strtok ((char *) NULL, field)) - || !(action = strtok ((char *) NULL, field)) - || strtok ((char *) NULL, field)) { + || !(from_users = strtok (NULL, field)) + || !(action = strtok (NULL, field)) + || strtok (NULL, field)) { SYSLOG ((LOG_ERR, "%s, line %d. Bad number of fields.\n", SUAUTHFILE, lines)); -- cgit v1.2.3