From: Andrew Shadura Subject: Fix +CSMS response parsing: an argument can be zero-length (Closes: #602739). diff --git a/gsmlib/gsm_me_ta.cc b/gsmlib/gsm_me_ta.cc --- a/gsmlib/gsm_me_ta.cc +++ b/gsmlib/gsm_me_ta.cc @@ -88,7 +88,17 @@ void MeTa::init() throw(GsmException) // find out whether we are supposed to send an acknowledgment Parser p(_at->chat("+CSMS?", "+CSMS:")); - _capabilities._sendAck = p.parseInt() >= 1; + try { + _capabilities._sendAck = p.parseInt() >= 1; + } + catch (GsmException &e) + { + if (e.getErrorClass() == ParserError) { + _capabilities._sendAck = 0; + } else { + throw e; + } + } // set GSM default character set try @@ -1002,8 +1012,18 @@ void MeTa::setMessageService(int service unsigned int MeTa::getMessageService() throw(GsmException) { - Parser p(_at->chat("+CSMS?", "+CSMS:")); - return p.parseInt(); + try { + Parser p(_at->chat("+CSMS?", "+CSMS:")); + return p.parseInt(); + } + catch (GsmException &e) + { + if (e.getErrorClass() == ParserError) { + return 0; + } else { + throw e; + } + } } void MeTa::getSMSRoutingToTA(bool &smsRouted,