]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More scan fixes
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 26 Jan 2022 00:33:50 +0000 (18:33 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 26 Jan 2022 00:33:50 +0000 (18:33 -0600)
src/lib/server/tmpl_tokenize.c
src/lib/util/value.h

index de102dc2175afb03b4a6ba0e05d12a859ae9fa3d..0dc12451e2ae4091f95fa0257e4afc81819821c2 100644 (file)
@@ -355,9 +355,6 @@ size_t tmpl_pair_list_name(tmpl_pair_list_t *out, char const *name, tmpl_pair_li
        char const *p = name;
        char const *q;
 
-       /* This should never be a NULL pointer */
-       fr_assert(name);
-
        /*
         *      Try and determine the end of the token
         */
@@ -744,18 +741,18 @@ int tmpl_afrom_value_box(TALLOC_CTX *ctx, tmpl_t **out, fr_value_box_t *data, bo
 
        MEM(vpt = talloc(ctx, tmpl_t));
        len = fr_value_box_aprint(vpt, &name, data, fr_value_escape_by_quote[quote]);
+       if (len < 0) {
+       error:
+               talloc_free(vpt);
+               return -1;
+       }
+
        tmpl_init_shallow(vpt, TMPL_TYPE_DATA, quote, name, len);
 
        if (steal) {
-               if (fr_value_box_steal(vpt, tmpl_value(vpt), data) < 0) {
-                       talloc_free(vpt);
-                       return -1;
-               }
+               if (fr_value_box_steal(vpt, tmpl_value(vpt), data) < 0) goto error;
        } else {
-               if (fr_value_box_copy(vpt, tmpl_value(vpt), data) < 0) {
-                       talloc_free(vpt);
-                       return -1;
-               }
+               if (fr_value_box_copy(vpt, tmpl_value(vpt), data) < 0) goto error;
        }
        *out = vpt;
 
index 658921e2212b6dd5f6aa107996d20ff8c92d3395..a2319257979f5f3bde2c95e92ee15b9a2c182fa9 100644 (file)
@@ -869,17 +869,14 @@ ssize_t           fr_value_box_print(fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuf
 
 ssize_t                fr_value_box_print_quoted(fr_sbuff_t *out, fr_value_box_t const *data, fr_token_t quote) CC_HINT(nonnull);
 
-static inline size_t fr_value_box_aprint(TALLOC_CTX *ctx, char **out,
-                                        fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)
-{
-       SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print, data, e_rules)
-}
+static inline fr_slen_t fr_value_box_aprint(TALLOC_CTX *ctx, char **out,
+                                           fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)
+               SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print, data, e_rules)
+
+static inline fr_slen_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out,
+                                                  fr_value_box_t const *data, fr_token_t quote)
+               SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print_quoted, data, quote)
 
-static inline size_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out,
-                                               fr_value_box_t const *data, fr_token_t quote)
-{
-       SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print_quoted, data, quote)
-}
 /** @} */
 /** @name Hashing
  *