diff options
author | Not Zed <NotZed@Ximian.com> | 2004-11-02 10:33:34 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-11-02 10:33:34 +0800 |
commit | 79b860a6c21124e3113af1055d0d0cfd50319c90 (patch) | |
tree | 36129024c4e09d44daed794cf9999ea186f85301 | |
parent | 43d766ff70995f1f6b4f6023bf62dc480e8647bc (diff) | |
download | gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar.gz gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar.bz2 gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar.lz gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar.xz gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.tar.zst gsoc2013-evolution-79b860a6c21124e3113af1055d0d0cfd50319c90.zip |
** See bug #68787
2004-11-01 Not Zed <NotZed@Ximian.com>
** See bug #68787
* e-account.c (xml_set_content): check the new val isn't null
before dereferencing it.
* e-account.c (xml_set_prop): same here.
svn path=/trunk/; revision=27789
-rw-r--r-- | e-util/ChangeLog | 8 | ||||
-rw-r--r-- | e-util/e-account.c | 69 |
2 files changed, 47 insertions, 30 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 93acfbf80c..5b94bb0cd9 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,11 @@ +2004-11-01 Not Zed <NotZed@Ximian.com> + + ** See bug #68787 + + * e-account.c (xml_set_content): check the new val isn't null + before dereferencing it. + * e-account.c (xml_set_prop): same here. + 2004-10-28 Not Zed <NotZed@Ximian.com> * e-config.c (ec_rebuild): revert the last change. diff --git a/e-util/e-account.c b/e-util/e-account.c index 61282ced8e..c75c0cf7f8 100644 --- a/e-util/e-account.c +++ b/e-util/e-account.c @@ -245,45 +245,51 @@ xml_set_int (xmlNodePtr node, const char *name, int *val) static gboolean xml_set_prop (xmlNodePtr node, const char *name, char **val) { - char *buf, *new_val; - - buf = xmlGetProp (node, name); - new_val = g_strdup (buf); - xmlFree (buf); - - /* We can use strcmp here whether the value is UTF8 or - * not, since we only care if the bytes changed. - */ - if (!*val || strcmp (*val, new_val)) { - g_free (*val); - *val = new_val; - return TRUE; + char *buf; + int res; + + buf = xmlGetProp(node, name); + if (buf == NULL) { + res = (*val != NULL); + if (res) { + g_free(*val); + *val = NULL; + } } else { - g_free (new_val); - return FALSE; + res = *val == NULL || strcmp(*val, buf) != 0; + if (res) { + g_free(*val); + *val = g_strdup(buf); + } + xmlFree(buf); } + + return res; } static gboolean xml_set_content (xmlNodePtr node, char **val) { - char *buf, *new_val; - - buf = xmlNodeGetContent (node); - new_val = g_strdup (buf); - xmlFree (buf); - - /* We can use strcmp here whether the value is UTF8 or - * not, since we only care if the bytes changed. - */ - if (!*val || strcmp (*val, new_val)) { - g_free (*val); - *val = new_val; - return TRUE; + char *buf; + int res; + + buf = xmlNodeGetContent(node); + if (buf == NULL) { + res = (*val != NULL); + if (res) { + g_free(*val); + *val = NULL; + } } else { - g_free (new_val); - return FALSE; + res = *val == NULL || strcmp(*val, buf) != 0; + if (res) { + g_free(*val); + *val = g_strdup(buf); + } + xmlFree(buf); } + + return res; } static gboolean @@ -303,6 +309,9 @@ xml_set_identity (xmlNodePtr node, EAccountIdentity *id) else if (!strcmp (node->name, "signature")) { changed |= xml_set_prop (node, "uid", &id->sig_uid); if (!id->sig_uid) { + + /* WTF is this shit doing here? Migrate is supposed to "handle this" */ + /* set a fake sig uid so the migrate code can handle this */ gboolean autogen = FALSE; int sig_id = 0; |