diff options
-rw-r--r-- | src/p18/response.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/p18/response.cc b/src/p18/response.cc index 2a3f78c..af9e490 100644 --- a/src/p18/response.cc +++ b/src/p18/response.cc @@ -8,6 +8,7 @@ #include "response.h" #include "exceptions.h" +#include "../logging.h" #define RETURN_TABLE(...) \ return std::shared_ptr<formatter::Table<VariantHolder>>( \ @@ -89,6 +90,12 @@ std::vector<std::string> GetResponse::getList(std::vector<FieldLength> itemLengt // check each item's length for (int i = 0; i < list.size(); i++) { + if (i >= itemLengths.size()) { + myerr << "while parsing " << demangle_type_name(typeid(*this).name()) + << ": item " << i << " is not expected"; + break; + } + if (!itemLengths[i].validate(list[i].size())) { std::ostringstream error; error << "while parsing " << demangle_type_name(typeid(*this).name()); |