From 200bc6364ed9e5654f1d32705fdd94cbbd433d67 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Mon, 26 Apr 2021 19:28:44 +0200 Subject: [PATCH] fsparser: fix checksum with GW1NS-2C, when configuration data is smaller than theory --- src/fsparser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fsparser.cpp b/src/fsparser.cpp index c5fd0e7..8ff19a2 100644 --- a/src/fsparser.cpp +++ b/src/fsparser.cpp @@ -187,6 +187,12 @@ int FsParser::parse() nb_line = 0; } + /* For configuration data checksum: number of lines can't be higher than + * the number indicates in TN653 but may be smaller (seen with the GW1NS-2C). + */ + if (stoi(_hdr["ConfDataLength"]) < nb_line) + nb_line = stoi(_hdr["ConfDataLength"]); + /* drop now useless header */ _lstRawData.erase(_lstRawData.begin(), _lstRawData.begin() + _end_header + 1); _lstRawData.resize(nb_line);