Source: gsmlib
Version: 1.10-13
Severity: normal
Tags: patch
Gsmlib's +COPS response parsing doesn't expect 5th parameter which
present when using at least Dell 5505 modem or Nokia 6303:
=== Nokia 6303:
AT+COPS=?
+COPS: (2,"Orange SK",,"23101",0),
(3,"O2-SK",,"23106",0),
(3,"T-Mobile SK",,"23102",0),,(0,1,3),(0,2)
OK
===
gsmctl[ERROR]: expected ')' (at position 24 of string '(2,"Orange
SK",,"23101",0),')
=== Dell 5505:
AT+COPS=?
+COPS: (1,"T-Mobile SK","TMO SK","23102",0)
+COPS: (2,"T-Mobile SK","TMO SK","23102",2)
+COPS: (3,"Unknown","Unknown","23106",0)
+COPS: (1,"Orange SK","Orange","23101",0)
+COPS: (0,"Orange SK","Orange","23101",2)
OK
===
gsmctl[ERROR]: expected ')' (at position 34 of string '(1,"T-Mobile SK","TMO
SK","23102",0)')
Here's the patch which fixes this problem.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1,
'experimental')
Architecture: i386 (i686)
Kernel: Linux 3.3.0-trunk-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash
--- Begin Message ---
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
@@ -367,6 +367,20 @@
else
throw e;
}
+ try
+ {
+ opi._numericName = p.parseComma();
+ p.parseInt(true);
+ }
+ catch (GsmException &e)
+ {
+ if (e.getErrorClass() == ParserError)
+ {
+ /* okay */
+ }
+ else
+ throw e;
+ }
if (expectClosingBracket) p.parseChar(')');
result.push_back(opi);
if (! p.parseComma(true)) break;
--- End Message ---