#3899: mutt_ssl's interactive_check_cert() has several issues
-----------------------+----------------------
Reporter: kevin8t8 | Owner: mutt-dev
Type: defect | Status: new
Priority: major | Milestone:
Component: crypto | Version:
Resolution: | Keywords:
-----------------------+----------------------
Comment (by vinc17):
{{{
+/* Use this with care. If the compiler can't see the array
+ * definition, it obviously won't produce a correct result */
+#define mutt_array_size(x) (sizeof (x) / sizeof ((x)[0]))
}}}
If you fear of incorrect use, one can add a check that {{{sizeof (x)}}} is
a multiple of {{{sizeof ((x)[0])}}}, though this wouldn't be very useful
in practice. Also comparing the variable size {{{sizeof (x)}}} and the
element size {{{sizeof (&(x)[0])}}} may be useful, but it would yield an
error for 1-element arrays whose size is the same as the pointer size;
however, when this macro is used, the array probably has more than one
element, so that this should be safe.
--
Ticket URL: <https://dev.mutt.org/trac/ticket/3899#comment:5>
Mutt <http://www.mutt.org/>
The Mutt mail user agent