Hi Jeevaka,
2010/11/24 Jeevaka Badrappan <jeevaka.badrappan(a)elektrobit.com>:
---
drivers/isimodem/call-forwarding.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/isimodem/call-forwarding.c b/drivers/isimodem/call-forwarding.c
index 1448451..c364bdf 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -98,12 +98,20 @@ static gboolean decode_gsm_forwarding_info(const void *restrict
data,
uint8_t _ton;
char *_number = NULL;
- if (!g_isi_sb_iter_get_byte(&iter, &_status, 3)
- || !g_isi_sb_iter_get_byte(&iter, &_ton, 4)
- || !g_isi_sb_iter_get_byte(&iter, &_norply, 5)
- || !g_isi_sb_iter_get_byte(&iter, &_numlen, 7)
- || !g_isi_sb_iter_get_alpha_tag(&iter, &_number,
- _numlen * 2, 10))
+ if (status && !g_isi_sb_iter_get_byte(&iter,
&_status, 3))
+ return FALSE;
+
+ if (ton && !g_isi_sb_iter_get_byte(&iter, &_ton,
4))
+ return FALSE;
+
+ if (norply && !g_isi_sb_iter_get_byte(&iter,
&_norply, 5))
+ return FALSE;
+
+ if (number && !g_isi_sb_iter_get_byte(&iter,
&_numlen, 7))
+ return FALSE;
+
+ if (number && !g_isi_sb_iter_get_alpha_tag(&iter,
+ &_number, _numlen * 2, 10))
return FALSE;
I think the problem is that we try to decode the alpha tag even when
it is not present, i.e., when _numlen is zero.
In fact, this has already been fixed in my current working tree in a
bit different way. Mostly due to the fact that I added a new
g_isi_sb_iter_get_struct() method, which allows a little easier access
to sub-blocks like the one above.
If you're curious, here's the tree with the fix:
http://meego.gitorious.org/~akiniemi/meego-cellular/ofono-aki/commits/gisi
Thanks for the report in any case! ;)
Cheers,
Aki