[patch] 1/2 segfault when call network_opers_parse()

andrzej zaborowski balrogg at gmail.com
Mon Jan 7 18:37:02 CET 2008


On 07/01/2008, Sean Chiang <sean_chiang at openmoko.com> wrote:
> HI!
> Refer to #1154, when call network_opers_parse() it'll cause segfault
> sometimes. I refactoried network_opers_parse() to solve this issue.

Thanks. I think

-           if (n < 10 || str[n - 1] != ')')
+           if (n < 10 || !n || str[n - 1] != ')')

would also be enough to prevent the segfault.  However the issue, that
can be seen in the backtrace from Mike Montour is that atcmd_done()
has sent a random string to network_opers_cb().  In the log we can see
that the response from modem was normal text, but network_opers_cb()
contained rubbish characters and this is what caused the segfault. I
haven't found out why this happened.

More information about the gsmd-devel mailing list