From: Alan T. DeKok Date: Fri, 18 Nov 2022 23:09:05 +0000 (-0500) Subject: use macros to initialize fields instead of memset X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c9ae5074b52ff913718fd642a53147ae40d6e27;p=thirdparty%2Ffreeradius-server.git use macros to initialize fields instead of memset for the odd case where we cast a pre-existing value-box from a string, AND that string is zero length, the cast silently succeeds BUT leaves the destination value-box as FR_TYPE_NULL Which seems bad --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 85943383237..aba8ac713d4 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -3218,7 +3218,7 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, /* * Initialise dst */ - memset(dst, 0, sizeof(*dst)); + fr_value_box_init(dst, dst_type, NULL, src->tainted); /* * Dispatch to specialised cast functions @@ -3311,7 +3311,7 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, return -1; } - memset(&tmp, 0, sizeof(tmp)); + fr_value_box_init(&tmp, dst_type, NULL, false); /* * Copy the raw octets into the datum of a value_box