]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
value box functions may mangle types
authorAlan T. DeKok <aland@freeradius.org>
Sat, 30 Jun 2018 12:54:20 +0000 (08:54 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 30 Jun 2018 13:07:44 +0000 (09:07 -0400)
so use temporary variable

src/main/command.c

index f1d44a957a667d29e5d721e56d675ac73441f1be..51e06a36cef7097eea34d5e2f8b3f6f32a0ecb7c 100644 (file)
@@ -923,13 +923,20 @@ int fr_command_run(FILE *fp, fr_cmd_t *head, int argc, char const *argv[])
                        fr_value_box_t box;
                        char quote;
                        int offset = i + 1 + j;
+                       fr_type_t type;
 
-                       if (cmd->syntax_types[j] == FR_TYPE_INVALID) {
+                       /*
+                        *      May be written to for things like
+                        *      "combo_ipaddr".
+                        */
+                       type = cmd->syntax_types[j];
+
+                       if (type == FR_TYPE_INVALID) {
                                continue;
                        }
 
                        quote = '\0';
-                       if (cmd->syntax_types[j] == FR_TYPE_STRING) {
+                       if (type == FR_TYPE_STRING) {
                                if ((argv[offset][0] == '"') ||
                                    (argv[offset][0] == '\'')) {
                                        quote = argv[offset][0];
@@ -939,7 +946,7 @@ int fr_command_run(FILE *fp, fr_cmd_t *head, int argc, char const *argv[])
                        /*
                         *      Parse the data to be sure it's well formed.
                         */
-                       if (fr_value_box_from_str(NULL, &box, &cmd->syntax_types[j],
+                       if (fr_value_box_from_str(NULL, &box, &type,
                                                  NULL, argv[offset], -1, quote, true) < 0) {
                                return -(offset);
                        }