cipher:pubkey: Fix non-use of flexible array member.
* cipher/pubkey.c (struct pk_single_data): Use 1 as the size. (_gcry_pk_single_data_push): Use offsetof.
- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
cipher:pubkey: Fix non-use of flexible array member.
Description
Details
Event TimelineComment Actions I doubt that we will ever be able to use the flexible array thingy. The old pattern has been used for nearly 50 years and replacing it will just introduce bugs. Comment Actions I agree that the "future" won't come, ever. (for libgcrypt) In my research around the variable length structure, the use of offsetof is considered good (for the correctness of the caluculation of the size). Although it's not in the core part of the C language (like NULL or size_t), it has been supported among most C environment (even pre-ISO/non-ISO implementations). For GCC, since GCC 4, we have __builtin_offsetof, and the calculation is reliable enough. |