From: Alan T. DeKok Date: Sat, 30 Jun 2018 12:54:20 +0000 (-0400) Subject: value box functions may mangle types X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eebf894cd6ccdcb423de2545e17cec84c816795f;p=thirdparty%2Ffreeradius-server.git value box functions may mangle types so use temporary variable --- diff --git a/src/main/command.c b/src/main/command.c index f1d44a957a6..51e06a36cef 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -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); }