diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-16 21:02:18 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-19 18:40:16 +0000 |
commit | 1181e0590c9f059c40b71718d4fb3b6c339f65db (patch) | |
tree | 96da444742d360992e91d6f937e461892ff5f1c0 /modules/pam_timestamp/hmacfile.c | |
parent | a8b4dce7b53d73de372e150028c970ee0a2a2e97 (diff) | |
download | pam-1181e0590c9f059c40b71718d4fb3b6c339f65db.tar.gz pam-1181e0590c9f059c40b71718d4fb3b6c339f65db.tar.bz2 pam-1181e0590c9f059c40b71718d4fb3b6c339f65db.zip |
Use PAM_ARRAY_SIZE
Replace all instances of sizeof(x) / sizeof(*x) with PAM_ARRAY_SIZE(x)
which is less error-prone and implements an additional type check.
* libpam/pam_handlers.c: Include "pam_inline.h".
(_pam_open_config_file): Use PAM_ARRAY_SIZE.
* modules/pam_exec/pam_exec.c: Include "pam_inline.h".
(call_exec): Use PAM_ARRAY_SIZE.
* modules/pam_namespace/pam_namespace.c: Include "pam_inline.h".
(filter_mntopts): Use PAM_ARRAY_SIZE.
* modules/pam_timestamp/hmacfile.c: Include "pam_inline.h".
(testvectors): Use PAM_ARRAY_SIZE.
* modules/pam_xauth/pam_xauth.c: Include "pam_inline.h".
(run_coprocess, pam_sm_open_session): Use PAM_ARRAY_SIZE.
* tests/tst-pam_get_item.c: Include "pam_inline.h".
(main): Use PAM_ARRAY_SIZE.
* tests/tst-pam_set_item.c: Likewise.
* xtests/tst-pam_pwhistory1.c: Likewise.
* xtests/tst-pam_time1.c: Likewise.
Diffstat (limited to 'modules/pam_timestamp/hmacfile.c')
-rw-r--r-- | modules/pam_timestamp/hmacfile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/pam_timestamp/hmacfile.c b/modules/pam_timestamp/hmacfile.c index 69d39afa..371f814e 100644 --- a/modules/pam_timestamp/hmacfile.c +++ b/modules/pam_timestamp/hmacfile.c @@ -33,6 +33,8 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "pam_inline.h" + #include <sys/types.h> #include <sys/stat.h> #include <errno.h> @@ -104,7 +106,7 @@ testvectors(void) "e8e99d0f45237d786d6bbaa7965c7808bbff1a91", }, }; - for (i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) { + for (i = 0; i < PAM_ARRAY_SIZE(vectors); i++) { hmac = NULL; hmac_len = 0; hmac_sha1_generate(&hmac, &hmac_len, |