]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Shut up clang analyzer
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 10 Oct 2019 03:49:13 +0000 (23:49 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 10 Oct 2019 03:49:13 +0000 (23:49 -0400)
src/bin/unit_test_attribute.c

index c0060b132dc7ba19c2334bdba953e267ea380e42..bea0f6de4ed83d0bfce6734f512f54a56a5606d7 100644 (file)
@@ -347,6 +347,16 @@ static ssize_t hex_to_bin(uint8_t *out, size_t outlen, char *in, size_t inlen)
                if (!c1) {
                bad_input:
                        fr_strerror_printf("Invalid hex data starting at \"%s\"", p);
+#ifdef __clang_analyzer__
+                       /*
+                        *      Clang analyzer fails to recognise
+                        *      that the p will always be greater
+                        *      than or equal to in, and so the
+                        *      the value will always be less than
+                        *      or equal to zero.
+                        */
+                       if (!fr_cond_assert(p >= in)) return 0;
+#endif
                        return in - p;
                }