]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Catch uses of uninitialised fields
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Dec 2022 02:27:10 +0000 (20:27 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Dec 2022 02:27:10 +0000 (20:27 -0600)
src/lib/util/pair.c

index 8c50817252465e02abb08238e80879ed8d5a1d12..8dde9aebe29b1592c07a9d9f3b4b40978d797690 100644 (file)
@@ -183,6 +183,14 @@ static inline CC_HINT(always_inline) void pair_init_from_da(fr_pair_t *vp, fr_di
        if (likely(fr_type_is_leaf(da->type))) {
                fr_value_box_init(&vp->data, da->type, da, false);
        } else {
+#ifndef NDEBUG
+               /*
+                *      Make it very obvious if we failed
+                *      to initialise something.
+                */
+               memset(&vp->data, 0xff, sizeof(vp->data));
+#endif
+
                /*
                 *      Hack around const issues...
                 */