| 1 |
From: Andrew Shadura <[email protected]> |
| 2 |
Subject: Fix +CSMS response parsing: an argument can be zero-length (Closes: #602739). |
| 3 |
|
| 4 |
diff --git a/gsmlib/gsm_me_ta.cc b/gsmlib/gsm_me_ta.cc |
| 5 |
--- a/gsmlib/gsm_me_ta.cc |
| 6 |
+++ b/gsmlib/gsm_me_ta.cc |
| 7 |
@@ -88,7 +88,17 @@ void MeTa::init() throw(GsmException) |
| 8 |
|
| 9 |
// find out whether we are supposed to send an acknowledgment |
| 10 |
Parser p(_at->chat("+CSMS?", "+CSMS:")); |
| 11 |
|
| 12 |
+ try { |
| 13 |
+ _capabilities._sendAck = p.parseInt() >= 1; |
| 14 |
+ } |
| 15 |
+ catch (GsmException &e) |
| 16 |
+ { |
| 17 |
+ if (e.getErrorClass() == ParserError) { |
| 18 |
+ _capabilities._sendAck = 0; |
| 19 |
+ } else { |
| 20 |
+ throw e; |
| 21 |
+ } |
| 22 |
+ } |
| 23 |
|
| 24 |
// set GSM default character set |
| 25 |
try |
| 26 |
@@ -1002,8 +1012,18 @@ void MeTa::setMessageService(int service |
| 27 |
|
| 28 |
unsigned int MeTa::getMessageService() throw(GsmException) |
| 29 |
{ |
| 30 |
|
| 31 |
|
| 32 |
+ try { |
| 33 |
+ Parser p(_at->chat("+CSMS?", "+CSMS:")); |
| 34 |
+ return p.parseInt(); |
| 35 |
+ } |
| 36 |
+ catch (GsmException &e) |
| 37 |
+ { |
| 38 |
+ if (e.getErrorClass() == ParserError) { |
| 39 |
+ return 0; |
| 40 |
+ } else { |
| 41 |
+ throw e; |
| 42 |
+ } |
| 43 |
+ } |
| 44 |
} |
| 45 |
|
| 46 |
void MeTa::getSMSRoutingToTA(bool &smsRouted, |