aboutsummaryrefslogtreecommitdiff
path: root/crypto/asn1
diff options
context:
space:
mode:
authorBenjamin Kaduk <bkaduk@akamai.com>2021-05-04 12:33:28 -0700
committerBenjamin Kaduk <bkaduk@akamai.com>2021-05-08 09:22:36 -0700
commit32b1da718d5d6f35fcef82f3794273807d6202e9 (patch)
treea55d6ee323e2e88f85fcc3ade3e0e147a5ae76f2 /crypto/asn1
parentab9d1af955ef71c0000bc27140623481a003d35c (diff)
downloadopenssl-32b1da718d5d6f35fcef82f3794273807d6202e9.zip
openssl-32b1da718d5d6f35fcef82f3794273807d6202e9.tar.gz
openssl-32b1da718d5d6f35fcef82f3794273807d6202e9.tar.bz2
tasn_dec: use do/while around statement macros
Use the do {} while (0) construct around macros whose bodies are complete statements (including one that has internal control flow!). This is safer and avoids any risk of misinterpretation if the macro is used in an unexpected context. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15143)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/tasn_dec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index 20717df..aaf3de7 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -90,9 +90,9 @@ unsigned long ASN1_tag2bit(int tag)
/* Macro to initialize and invalidate the cache */
-#define asn1_tlc_clear(c) if ((c) != NULL) (c)->valid = 0
+#define asn1_tlc_clear(c) do { if ((c) != NULL) (c)->valid = 0; } while (0)
/* Version to avoid compiler warning about 'c' always non-NULL */
-#define asn1_tlc_clear_nc(c) (c)->valid = 0
+#define asn1_tlc_clear_nc(c) do {(c)->valid = 0; } while (0)
/*
* Decode an ASN1 item, this currently behaves just like a standard 'd2i'