[Bug 400839] Re: newest gurlchecker segfaults on Karmic

hyperqbe dmenest-ubuntu at ofb.net
Sat Nov 7 06:53:33 GMT 2009


Perhaps I should explain the patch.  The problem was that g_strstrip()
was being called on the result of gtk_entry_get_text() for the username
and password fields.  Normally this might not be a problem, but when a
GtkEntry has not been modified, gtk_entry_get_text() will return "".
That is, the *constant* string "".  g_strstrip("") segfaults.

There are many possible solutions to this.  One could check for the
special case of an empty string, but that felt like a bit of a difficult
to explain hack.  The option I took was to call g_strdup() on the two
strings.  This requires the caller of the uc_utils_get_auth_fields()
function to g_free these strings.  However, uc_utils_get_auth_fields()
already requires the caller to g_free one of the three strings it
returns.  Requiring the caller to g_free the other two makes the
interface more consistent.

So the patch adds the calls to g_strdup(), and whereever
uc_utils_get_auth_fields() is called (twice), we add g_free() calls to
free the new strings.

-- 
newest gurlchecker segfaults on Karmic
https://bugs.launchpad.net/bugs/400839
You received this bug notification because you are a member of Ubuntu
Sponsors for universe, which is a direct subscriber.



More information about the Ubuntu-universe-sponsors mailing list