All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] ussd: Fix crash with long ussd string
  2012-03-30 13:16 [PATCH] ussd: Fix crash with long ussd string Nicolas Bertrand
@ 2012-03-30  6:38 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2012-03-30  6:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]

Hi Nicolas,

On 03/30/2012 08:16 AM, Nicolas Bertrand wrote:
> Some ZTE modem convert USSD string into UCS2 without respecting
> the limitation of 160 bytes. So cut off the string if greater than
> this limit
> ---
>  drivers/atmodem/ussd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
> index 443251a..bdee2d9 100644
> --- a/drivers/atmodem/ussd.c
> +++ b/drivers/atmodem/ussd.c
> @@ -158,7 +158,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
>  
>  	case SMS_CHARSET_8BIT:
>  	case SMS_CHARSET_UCS2:
> -		msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg);
> +		msg_ptr = decode_hex_own_buf(content, 320, &msg_len, 0, msg);
>  		break;
>  	}
>  

This isn't really the problem.  From the logs it seems that the ZTE
modem is sending us plain-text data that is hex-encoded in UCS2.

e.g.:

ofonod[1051]: Modem: < \r\n+CUSD:
1,"006D006F0062006900630061007200740065000A0056006F007400720065002000630072006500640069007400200065007300740020006500700075006900730065002E000A0050006F0075007200200063006F006E00730065007200760065007200200076006F0074007200650020006E0075006D00650072006F00200030003600340035003300310032003100310038000A00700065006E00730065007A0020006100200072006500630068006100720067006500720020006100760061006E00740020006C0065002000320031002F00300037002F00310032000A0031003D005200650063006800610072006700650072000A0032003D004D0065006E0075000A0033003D00410069006400650020002000200020",72\r\n

-> 006D, 006F, 0062, 0069, 0063, 0061, 0072, 0074, 0065 ...
    m     o     b    i     c     a     r     t     e    ...

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] ussd: Fix crash with long ussd string
@ 2012-03-30 13:16 Nicolas Bertrand
  2012-03-30  6:38 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Bertrand @ 2012-03-30 13:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

Some ZTE modem convert USSD string into UCS2 without respecting
the limitation of 160 bytes. So cut off the string if greater than
this limit
---
 drivers/atmodem/ussd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index 443251a..bdee2d9 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -158,7 +158,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
 
 	case SMS_CHARSET_8BIT:
 	case SMS_CHARSET_UCS2:
-		msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg);
+		msg_ptr = decode_hex_own_buf(content, 320, &msg_len, 0, msg);
 		break;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-30 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-30 13:16 [PATCH] ussd: Fix crash with long ussd string Nicolas Bertrand
2012-03-30  6:38 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.