]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
forbid smashing flags.
authorAlan T. DeKok <aland@freeradius.org>
Sat, 3 Oct 2020 12:30:30 +0000 (08:30 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 3 Oct 2020 12:30:30 +0000 (08:30 -0400)
once a flag is set, it shouldn't be overwritten

src/lib/util/dict_tokenize.c

index 0ecc0b03cc542f1b5927707022acbde58d5ef174..cb625702577a2988b3b66bbb75c07004537bf532 100644 (file)
@@ -458,6 +458,17 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type
 
                        if (value) value[-1] = '='; /* hackity hack */
 
+                       /*
+                        *      Protocol should use strings
+                        *      "key1,key2" to allow for multiple
+                        *      flags.
+                        */
+                       if (flags->subtype) {
+                               fr_strerror_printf("Cannot add flag '%s' - another flag is already set",
+                                                  key);
+                               return -1;
+                       }
+
                        subtype = fr_table_value_by_str(ctx->dict->subtype_table, key, -1);
                        if (subtype < 0) goto unknown_option;