gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segfault in xgnokii


From: Pawel Kot
Subject: Re: Segfault in xgnokii
Date: Thu, 5 Dec 2002 00:29:52 +0100 (CET)

On Wed, 4 Dec 2002, Ulrich Hopp wrote:

Hi Ulrich,

Again a good catch. :-)

> xgnokii_contacts.c line 427 :
>
> **************************
>                       if (phoneMonitor.supported & PM_EXTPBK) {
>                               number = g_malloc(sizeof(char) * 
> max_phonebook_number_length);
>                               gtk_label_get(GTK_LABEL(((EditEntryData *) 
> data)->number), number);
>
> **************************
> after this line the segfault happens :
> **************************
>                               snprintf(entry->entry.Number, 
> max_phonebook_number_length, "%s",
> number[0]);
>                               snprintf(entry->entry.SubEntries[0].data.Number,
> max_phonebook_number_length, "%s", number[0]);
>                               entry->entry.SubEntries[0].EntryType = 
> GSM_Number;
>                               entry->entry.SubEntries[0].NumberType = 
> GSM_General;
>                               entry->entry.SubEntriesCount = 1;
>                               g_free(number);
>
> **************************
> It seems that structure entry is not initialized here ( debugger says entry =
> 0x0 )
>
> After changing entry->.....  to  ((EditEntry_Data *) Data ) pbEntry->..... the
> segfault disappeared  but I don't know if I'm right.
>  Or should entry be initialized here ?

The code is quite messy there. I spent a couple of minutes analising this
function. And found one more issue there: an extented phonebook is not
handled correctly in case of writing to the phone memory, being in the
phone memory -- anyone to confirm with xgnokii?

And IMHO entry should be initialized. To be safe we can do this on
declaration:
        PhonebookEntry *entry = ((EditEntryData *) data)->pbEntry;

And then just use entry instead these long string. And we can replace
'((EditEntryData *) data)->pbEntry' with 'entry' in few places.

Markus, would you mind to take care of this?

pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku





reply via email to

[Prev in Thread] Current Thread [Next in Thread]