From e5b1c619c8672187551f3e3524ea0010fe1c80ec Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Tue, 5 Apr 2016 09:00:09 -0500 Subject: fix: segfault - check vector size before using --- src/MTS_IO_CellularRadio.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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 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); -- cgit v1.2.3