diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2024-01-02 21:13:07 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2024-01-03 17:16:02 +0000 |
commit | 2e677446e35898f1539e6522a826d392c6abde50 (patch) | |
tree | 6a4f33dcc16b52e776b276cd7b72c14857f64b6c /modules/pam_unix | |
parent | 8f2ca5919b26843ef774ef0aeb9bf261dec943a0 (diff) | |
download | pam-2e677446e35898f1539e6522a826d392c6abde50.tar.gz pam-2e677446e35898f1539e6522a826d392c6abde50.tar.bz2 pam-2e677446e35898f1539e6522a826d392c6abde50.zip |
pam_unix: use size_t instead of int for sizes
Also rename buflen to retlen, since it is not associated with the
variable buf, but ret.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules/pam_unix')
-rw-r--r-- | modules/pam_unix/support.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c index 49807873..bdba3ce5 100644 --- a/modules/pam_unix/support.c +++ b/modules/pam_unix/support.c @@ -348,9 +348,9 @@ int _unix_getpwnam(pam_handle_t *pamh, const char *name, { FILE *passwd; char buf[16384]; - int matched = 0, buflen; + int matched = 0; char *slogin, *spasswd, *suid, *sgid, *sgecos, *shome, *sshell, *p; - size_t userlen; + size_t retlen, userlen; memset(buf, 0, sizeof(buf)); @@ -438,17 +438,17 @@ int _unix_getpwnam(pam_handle_t *pamh, const char *name, } *sshell++ = '\0'; - buflen = sizeof(struct passwd) + + retlen = sizeof(struct passwd) + strlen(slogin) + 1 + strlen(spasswd) + 1 + strlen(sgecos) + 1 + strlen(shome) + 1 + strlen(sshell) + 1; - *ret = malloc(buflen); + *ret = malloc(retlen); if (*ret == NULL) { return matched; } - memset(*ret, '\0', buflen); + memset(*ret, '\0', retlen); (*ret)->pw_uid = strtol(suid, &p, 10); if ((strlen(suid) == 0) || (*p != '\0')) { |