[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SIGSEV in common/phones/atgen.c ReplyGetNetworkInfo()
From: |
Daniele Forsi |
Subject: |
SIGSEV in common/phones/atgen.c ReplyGetNetworkInfo() |
Date: |
Thu, 23 Mar 2006 10:58:04 +0100 |
User-agent: |
Mozilla Thunderbird 1.5 (X11/20051201) |
I'm testing a phone that answers to AT+COPS? with +COPS: 0,0,""
in this case at line 1749 in ReplyGetNetworkInfo()
1749: pos = strtok(pos, "\"");
pos gets a NULL so strlen() at line 1750 gets a NULL
1750: at_decode(drvinst->charset, tmp, pos, strlen(pos));
Index: common/phones/atgen.c
===================================================================
RCS file: /sources/gnokii/gnokii/common/phones/atgen.c,v
retrieving revision 1.118
diff -u -p -0 -r1.118 atgen.c
--- common/phones/atgen.c 13 Feb 2006 20:39:11 -0000 1.118
+++ common/phones/atgen.c 23 Mar 2006 09:34:23 -0000
@@ -1749,0 +1750 @@ static gn_error ReplyGetNetworkInfo(int
+ if (!pos) pos = ""; /* fix for +COPS: 0,0,"" */
Assigning a constant "" to pos seems safe since it is not changed in the
rest of the function.
The same phone has an 8 chars cellid, example:
AT+CREG?
+CREG: 2,1,"1234","12345678"
OK
but only the first four digits are copied by ReplyGetNetworkInfo():
tmp[0] = pos[0];
tmp[1] = pos[1];
data->network_info->cell_id[0] = strtol(tmp, NULL, 16);
tmp[0] = pos[2];
tmp[1] = pos[3];
data->network_info->cell_id[1] = strtol(tmp, NULL, 16);
I'm not sure why it is using strtol() when cellid is defined as
unsigned char cell_id[10] instead of just copying the string, maybe it's
old code?
--
Daniele
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- SIGSEV in common/phones/atgen.c ReplyGetNetworkInfo(),
Daniele Forsi <=