aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_access
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2023-12-14 19:50:12 +0100
committerDmitry V. Levin <ldv@strace.io>2023-12-14 20:04:32 +0000
commit9f733e5f3b8ae092e405d8bffa523a22155a7f6a (patch)
tree286eddb01419ff259636382239d69ff5e4a4c0e8 /modules/pam_access
parent954234f0a477636eab751a6601d34bab1db41b0e (diff)
downloadpam-9f733e5f3b8ae092e405d8bffa523a22155a7f6a.tar.gz
pam-9f733e5f3b8ae092e405d8bffa523a22155a7f6a.tar.bz2
pam-9f733e5f3b8ae092e405d8bffa523a22155a7f6a.zip
treewide: store strlen results in size_t
Very long strings could overflow the int data type. Make sure to use the correct data type. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules/pam_access')
-rw-r--r--modules/pam_access/pam_access.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c
index 04d7306b..a8efdf30 100644
--- a/modules/pam_access/pam_access.c
+++ b/modules/pam_access/pam_access.c
@@ -427,8 +427,8 @@ login_access (pam_handle_t *pamh, struct login_info *item)
#ifdef HAVE_LIBAUDIT
int nonall_match = NO;
#endif
- int end;
- int lineno = 0; /* for diagnostics */
+ size_t end;
+ size_t lineno = 0; /* for diagnostics */
char *sptr;
if (item->debug)
@@ -450,7 +450,7 @@ login_access (pam_handle_t *pamh, struct login_info *item)
lineno++;
if (line[end = strlen(line) - 1] != '\n') {
pam_syslog(pamh, LOG_ERR,
- "%s: line %d: missing newline or line too long",
+ "%s: line %zu: missing newline or line too long",
item->config_file, lineno);
continue;
}
@@ -466,18 +466,18 @@ login_access (pam_handle_t *pamh, struct login_info *item)
if (!(perm = strtok_r(line, item->fs, &sptr))
|| !(users = strtok_r(NULL, item->fs, &sptr))
|| !(froms = strtok_r(NULL, "\n", &sptr))) {
- pam_syslog(pamh, LOG_ERR, "%s: line %d: bad field count",
+ pam_syslog(pamh, LOG_ERR, "%s: line %zu: bad field count",
item->config_file, lineno);
continue;
}
if (perm[0] != '+' && perm[0] != '-') {
- pam_syslog(pamh, LOG_ERR, "%s: line %d: bad first field",
+ pam_syslog(pamh, LOG_ERR, "%s: line %zu: bad first field",
item->config_file, lineno);
continue;
}
if (item->debug)
pam_syslog (pamh, LOG_DEBUG,
- "line %d: %s : %s : %s", lineno, perm, users, froms);
+ "line %zu: %s : %s : %s", lineno, perm, users, froms);
match = list_match(pamh, users, NULL, item, user_match);
if (item->debug)
pam_syslog (pamh, LOG_DEBUG, "user_match=%d, \"%s\"",