diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-07-14 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-07-15 08:05:07 +0000 |
commit | 40513560a03d51923cfa717d1360ec9f351a6775 (patch) | |
tree | e01ec8cffdadcb1be073e3e7051fdabb90b24e5c /libpam/include/pam_inline.h | |
parent | 48f44125fac8873237ade9e94942f82a8e6d6e1d (diff) | |
download | pam-40513560a03d51923cfa717d1360ec9f351a6775.tar.gz pam-40513560a03d51923cfa717d1360ec9f351a6775.tar.bz2 pam-40513560a03d51923cfa717d1360ec9f351a6775.zip |
pam_inline.h: cleanup pam_read_passwords a bit
* libpam/include/pam_inline.h (pam_read_passwords): Increment pptr once
instead of using pptr+1 several times. This change is not expected
to affect the code generated by the compiler as the latter is likely
to perform the optimization itself.
Diffstat (limited to 'libpam/include/pam_inline.h')
-rw-r--r-- | libpam/include/pam_inline.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libpam/include/pam_inline.h b/libpam/include/pam_inline.h index 8040b865..ec2f3bf0 100644 --- a/libpam/include/pam_inline.h +++ b/libpam/include/pam_inline.h @@ -90,17 +90,18 @@ pam_read_passwords(int fd, int npass, char **passwords) break; } - while (npass > 0 && (pptr=memchr(passwords[i]+offset, '\0', rbytes)) - != NULL) { - rbytes -= pptr - (passwords[i]+offset) + 1; + while (npass > 0 && + (pptr = memchr(passwords[i] + offset, '\0', rbytes)) != NULL) { + ++pptr; /* skip the '\0' */ + rbytes -= pptr - (passwords[i] + offset); i++; offset = 0; npass--; if (rbytes > 0) { if (npass > 0) { - memcpy(passwords[i], pptr+1, rbytes); + memcpy(passwords[i], pptr, rbytes); } - memset(pptr+1, '\0', rbytes); + memset(pptr, '\0', rbytes); } } offset += rbytes; |