WC_FLEXIBLE_ARRAY_MEMBER to WC_FLEXIBLE_ARRAY_SIZE

This commit is contained in:
Anthony Hu
2026-07-08 14:07:44 -04:00
parent 661a6d0bf6
commit 80d4c28c39
2 changed files with 23 additions and 9 deletions
+4 -4
View File
@@ -3447,7 +3447,7 @@ typedef struct SignatureAlgorithms {
#pragma warning(disable: 4200)
#endif
/* sig/algo to offer */
byte hashSigAlgo[WC_FLEXIBLE_ARRAY_MEMBER];
byte hashSigAlgo[WC_FLEXIBLE_ARRAY_SIZE];
} SignatureAlgorithms;
WOLFSSL_LOCAL SignatureAlgorithms* TLSX_SignatureAlgorithms_New(
@@ -3630,7 +3630,7 @@ typedef struct ExternalTicket {
byte key_name[WOLFSSL_TICKET_NAME_SZ]; /* key context name - 16 */
byte iv[WOLFSSL_TICKET_IV_SZ]; /* this ticket's iv - 16 */
byte enc_len[OPAQUE16_LEN]; /* encrypted length - 2 */
byte enc_ticket[WC_FLEXIBLE_ARRAY_MEMBER]; /* encrypted ticket - var length
byte enc_ticket[WC_FLEXIBLE_ARRAY_SIZE]; /* encrypted ticket - var length
* + total mac - 32 */
} ExternalTicket;
@@ -3715,7 +3715,7 @@ typedef struct Cookie {
#ifdef _MSC_VER
#pragma warning(disable: 4200)
#endif
byte data[WC_FLEXIBLE_ARRAY_MEMBER];
byte data[WC_FLEXIBLE_ARRAY_SIZE];
} Cookie;
WOLFSSL_LOCAL int TLSX_Cookie_Use(const WOLFSSL* ssl, const byte* data,
@@ -5771,7 +5771,7 @@ typedef struct DtlsFragBucket {
#ifdef _MSC_VER
#pragma warning(disable: 4200)
#endif
byte buf[WC_FLEXIBLE_ARRAY_MEMBER];
byte buf[WC_FLEXIBLE_ARRAY_SIZE];
} DtlsFragBucket;
typedef struct DtlsMsg {
+19 -5
View File
@@ -221,13 +221,27 @@ typedef const char wcchar[];
#define WOLF_ENUM_DUMMY_LAST_ELEMENT(prefix) /* null expansion */
#endif
#if defined(WOLF_C89)
/* C99 flexible array member, or the C89 "struct hack" fallback.
#if defined(WC_FLEXIBLE_ARRAY_SIZE)
/* keep override value. */
#elif defined(__cplusplus)
/* No C++ standard has FAMs; [] and [0] are vendor extensions.
* Use the struct hack. */
#define WC_FLEXIBLE_ARRAY_SIZE 1
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
/* Standard C99+ flexible array member -- valid even under
* __STRICT_ANSI__ / -pedantic. */
#define WC_FLEXIBLE_ARRAY_SIZE
#elif defined(__STRICT_ANSI__) || defined(WOLF_C89)
/* C89 "struct hack" fallback.
* See http://c-faq.com/struct/structhack.html */
#define WC_FLEXIBLE_ARRAY_MEMBER 1
#define WC_FLEXIBLE_ARRAY_SIZE 1
#elif defined(__GNUC__) || defined(__clang__) || \
(defined(_MSC_VER) && !defined(__cplusplus))
/* gnu89 etc.: [] accepted as an extension without -pedantic;
* MSVC C mode accepts it too (C4200, off by default at /W3). */
#define WC_FLEXIBLE_ARRAY_SIZE
#else
/* empty: C99 flexible array member */
#define WC_FLEXIBLE_ARRAY_MEMBER
#define WC_FLEXIBLE_ARRAY_SIZE 1
#endif
/* try to set SIZEOF_LONG or SIZEOF_LONG_LONG if user didn't */