diff options
author | Brandon Bayer <bbayer@multitech.com> | 2016-04-05 09:00:09 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2016-04-05 09:00:09 -0500 |
commit | e5b1c619c8672187551f3e3524ea0010fe1c80ec (patch) | |
tree | f3c12bfe85d46791d56cfad890b1fa1da472c5b2 | |
parent | a07abd74684cdbd6413cd4489627a236018725c8 (diff) | |
download | libmts-io-e5b1c619c8672187551f3e3524ea0010fe1c80ec.tar.gz libmts-io-e5b1c619c8672187551f3e3524ea0010fe1c80ec.tar.bz2 libmts-io-e5b1c619c8672187551f3e3524ea0010fe1c80ec.zip |
fix: segfault - check vector size before using0.5
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 6954368..71c4465 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -1084,7 +1084,11 @@ std::string CellularRadio::queryLteLac() { } else { size_t start = CGREGstring.find(":") + 1; //Position right after "#RFSTS:" std::vector<std::string> vParts = MTS::Text::split(MTS::Text::trim(CGREGstring.substr(start)), ","); - result = MTS::Text::strip(vParts[2], '"'); + if(vParts.size() < 3) { + result = CellularRadio::VALUE_UNAVAILABLE; + } else { + result = MTS::Text::strip(vParts[2], '"'); + } } setCGREG(originalCGREG); |