]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Uase __coverity_writeall__() in fr_value_vox_init() model
authorJames Jones <jejones3141@gmail.com>
Fri, 21 Jul 2023 12:55:47 +0000 (07:55 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 22 Jul 2023 13:32:45 +0000 (07:32 -0600)
src/coverity-model/merged_model.c

index 0bc3d015fda0e06924e8f444437217e3b9737924..e3d1d1f1c07adec8e73462d1a7a4f8006067e9ae 100644 (file)
@@ -138,19 +138,10 @@ fr_slen_t fr_base16_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr
 }
 
 /*
- * We have two choices here, both unfortunate. We can fill in the fields of fr_value_box_t, so
- * we can refer to sizeof(fr_value_box_t) in the fr_value_box_init() model, or we can determine
- * its size some other way and #define it to make its meaning clear. Both are subject to changes
- * in src/lib/util/value.h and whatever it (transitive closure of #include)s.
- *
- * OK. Actually giving the details of an fr_value_box_t at a level or so of indirection gets you
- * to a type that's defined via macros, not to mention that it's not clear whether there's a way
- * to force alignment in the "compiler" coverity uses on modeling files, which you'd need to get
- * sizeof(fr_value_box_datum_t), which is part of a fr_value_box_t.
+ * Here we can use __coverity_writeall__(), which tells coverity "however big the thing
+ * pointed at is, consider it all written."
  */
 
-#define REAL_SIZEOF_FR_VALUE_BOX_T     64
-
 typedef enum {
        FR_TYPE_NULL = 0,                       //!< Invalid (uninitialised) attribute type.
 
@@ -215,7 +206,7 @@ typedef struct {
 
 static void fr_value_box_init(fr_value_box_t *vb, fr_type_t type, fr_dict_attr_t const *enumv, bool tainted)
 {
-       __coverity_write_buffer_bytes__(vb, REAL_SIZEOF_FR_VALUE_BOX_T);
+       __coverity_writeall__(vb);
 }
 
 ssize_t fr_sbuff_out_bstrncpy_exact(fr_sbuff_t *out, fr_sbuff_t *in, size_t len)