]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't allow cast to structural types
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2017 22:31:46 +0000 (17:31 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2017 22:31:46 +0000 (17:31 -0500)
src/lib/value.c

index 350c43700909e6e9f59d3529c08a8a322213bb76..9c838884083f1a69c058972adea9fd828d33b329 100644 (file)
@@ -1236,6 +1236,13 @@ int value_box_cast(TALLOC_CTX *ctx, value_box_t *dst,
                    PW_TYPE src_type, fr_dict_attr_t const *src_enumv,
                    value_box_t const *src)
 {
+       if (fr_dict_non_data_types[dst_type]) {
+               fr_strerror_printf("Invalid cast from %s to %s.  Can only cast simple data types.",
+                                  fr_int2str(dict_attr_types, src_type, "<INVALID>"),
+                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+               return -1;
+       }
+
        /*
         *      If it's the same type, copy.
         */