diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-01-19 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-01-19 08:00:00 +0000 |
commit | cc3f6702afdea7e9a20983810c19f5cc58eaf5e8 (patch) | |
tree | bd5b2099173ebf87ea4b989b328c820001ed30a8 | |
parent | 2aae166e5e4ce921f750cb08f8da08f1cfcedead (diff) | |
download | linux-pam-git-cc3f6702afdea7e9a20983810c19f5cc58eaf5e8.tar.gz |
pam_client.h: silence compiler warning
gcc-12 insists on issuing the following warning:
In file included from libpamc.h:13,
from pamc_converse.c:9:
pamc_converse.c: In function 'pamc_converse':
include/security/pam_client.h:129:27: error: array subscript 'struct <anonymous>[0]' is partly outside array bounds of 'unsigned char[6]' [-Werror=array-bounds]
129 | (*(old_p))->control = cntrl; \
| ^~
pamc_converse.c:209:5: note: in expansion of macro 'PAM_BP_RENEW'
209 | PAM_BP_RENEW(prompt_p, PAM_BPC_FAIL, 0);
| ^~~~~~~~~~~~
include/security/pam_client.h:87:29: note: object of size 6 allocated by 'calloc'
87 | # define PAM_BP_CALLOC calloc
| ^
include/security/pam_client.h:124:29: note: in expansion of macro 'PAM_BP_CALLOC'
124 | if ((*(old_p) = PAM_BP_CALLOC(1, 1+__size))) { \
| ^~~~~~~~~~~~~
pamc_converse.c:209:5: note: in expansion of macro 'PAM_BP_RENEW'
209 | PAM_BP_RENEW(prompt_p, PAM_BPC_FAIL, 0);
| ^~~~~~~~~~~~
* libpamc/include/security/pam_client.h (pamc_bp_t): Decorate the
structure pointed by pamc_bp_t pointer as packed. Despite being a part
of the API, the structure is not supposed to be used directly, and all
the interface macros were assuming from the very beginning that this
structure is packed.
-rw-r--r-- | libpamc/include/security/pam_client.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libpamc/include/security/pam_client.h b/libpamc/include/security/pam_client.h index 41f83da6..0fc2cf44 100644 --- a/libpamc/include/security/pam_client.h +++ b/libpamc/include/security/pam_client.h @@ -24,7 +24,8 @@ extern "C" { typedef struct pamc_handle_s *pamc_handle_t; /* binary prompt structure pointer */ -typedef struct { uint32_t length; uint8_t control; } *pamc_bp_t; +typedef struct { uint32_t length; uint8_t control; } + __attribute__ ((__packed__)) *pamc_bp_t; /* * functions provided by libpamc |