summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-07-23 15:37:29 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-07-23 16:55:18 +0300
commit8af6be402eba48a02853bebc5f9f6d5b9e8844f3 (patch)
treee257a7cd8f01b26e608fe703288405ef1990e417 /include
parentd340135922da6eb881418824e470cbdba835b498 (diff)
downloadlibmts-io-8af6be402eba48a02853bebc5f9f6d5b9e8844f3.tar.gz
libmts-io-8af6be402eba48a02853bebc5f9f6d5b9e8844f3.tar.bz2
libmts-io-8af6be402eba48a02853bebc5f9f6d5b9e8844f3.zip
Quectel Delta Radio Firmware Upgrade support - libmts-io implementation
Added more strict handling for comma-separated data in URC messages to prevent out-of-bounds reads.
Diffstat (limited to 'include')
-rw-r--r--include/mts/MTS_IO_QuectelRadio.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h
index 41c89dc..58e3d25 100644
--- a/include/mts/MTS_IO_QuectelRadio.h
+++ b/include/mts/MTS_IO_QuectelRadio.h
@@ -82,8 +82,18 @@ namespace MTS {
static uint16_t getQuectelChecksum(const void* data, size_t nBytes);
static inline void updateQuectelChecksum(uint16_t& iChecksum, uint16_t iNewFragment);
static inline uint16_t bytesToUint16(uint8_t high, uint8_t low);
+
CODE fumoWaitUpgradeFinished(UpdateCb& stepCb);
CODE fumoWaitNewFirmware(UpdateCb& stepCb);
+
+ /// Get value from container by its index, use default value if not found. Non-template version.
+ const std::string& getByIndex(const std::vector<std::string>& vector, size_t index, const std::string& defaultValue) {
+ if (index >= vector.size()) {
+ return defaultValue;
+ } else {
+ return vector[index];
+ }
+ }
};
}
}