Skip to content

Commit e37a6fb

Browse files
committed
Test whether op is "SET" during parsing json file
1 parent d55b9b6 commit e37a6fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

common/json.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ bool JSon::loadJsonFromFile(ifstream &fs, vector<KeyOpFieldsValuesTuple> &db_ite
8383
kfvFieldsValues(cur_db_item).push_back(FieldValueTuple(field_str, value_str));
8484
}
8585
}
86+
else
87+
{
88+
auto op = cur_obj.get<string>();
89+
if (op != "SET")
90+
{
91+
SWSS_LOG_ERROR("Child elements'op field must be SET, but got %s, ignored", op.c_str());
92+
db_items.pop_back();
93+
break;
94+
}
95+
kfvOp(cur_db_item) = op;
96+
}
8697
}
8798
}
8899
else

0 commit comments

Comments
 (0)