]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Annotate false positives of using uninitalized variables (CIDs below) (#4653)
authorJames Jones <jejones3141@gmail.com>
Sat, 6 Aug 2022 15:20:45 +0000 (10:20 -0500)
committerGitHub <noreply@github.com>
Sat, 6 Aug 2022 15:20:45 +0000 (11:20 -0400)
CIDs: #1503917, #1503948, #1503959, #1503989

After the smoke clears, it turns out that (a == &one) is true
iff one was initialized and (b == &two) is true iff two was
initialized, so they're passed to fr_value_box_clear_value()
iff it makes sense.

src/lib/util/calc.c

index 57993f42d054e3fc8283f04870de9c83843041a1..890111b6b68700fff0cea53065823067690042a0 100644 (file)
@@ -919,7 +919,9 @@ static int calc_octets(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_t cons
                return ERR_INVALID;     /* invalid operator */
        }
 
+       /* coverity[uninit_use_in_call] */
        if (a == &one) fr_value_box_clear_value(&one);
+       /* coverity[uninit_use_in_call] */
        if (b == &two) fr_value_box_clear_value(&two);
 
        return 0;
@@ -1019,7 +1021,9 @@ static int calc_string(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_t cons
                return ERR_INVALID;     /* invalid operator */
        }
 
+       /* coverity[uninit_use_in_call] */
        if (a == &one) fr_value_box_clear_value(&one);
+       /* coverity[uninit_use_in_call] */
        if (b == &two) fr_value_box_clear_value(&two);
 
        return 0;