diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-09-05 05:23:36 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-09-05 05:23:36 +0800 |
commit | e724a9a9cfbc3a0c532d0781d5ee304dd724fddc (patch) | |
tree | 1e1bf119f5ab5db0cc0adb66eeccca812478a1bf | |
parent | d28a3e110080adf3f31e47a2b60120d175bb387e (diff) | |
download | gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar.gz gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar.bz2 gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar.lz gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar.xz gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.tar.zst gsoc2013-evolution-e724a9a9cfbc3a0c532d0781d5ee304dd724fddc.zip |
some fixes
svn path=/trunk/; revision=17979
-rw-r--r-- | mail/upgrade-mailer.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/mail/upgrade-mailer.c b/mail/upgrade-mailer.c index 8470f56672..f20d482157 100644 --- a/mail/upgrade-mailer.c +++ b/mail/upgrade-mailer.c @@ -86,23 +86,32 @@ e_memmem (const void *haystack, size_t haystacklen, const void *needle, size_t n static char find_dir_sep (GByteArray *buf) { - unsigned char *p; + register unsigned char *inptr; + unsigned char *inend; - if (!(p = e_memmem (buf->data, buf->len, "* LSUB (", 8))) + inend = buf->data + buf->len; + + if (!(inptr = e_memmem (buf->data, buf->len, "* LSUB (", 8))) return '\0'; - p += 9; - while (*p != ')') - p++; + inptr += 9; + while (inptr < inend && *inptr != ')') + inptr++; - p++; - while (isspace ((int) *p)) - p++; + if (inptr >= inend) + return '\0'; - if (*p == '\"') - p++; + inptr++; + while (inptr < inend && isspace ((int) *inptr)) + inptr++; + + if (inptr >= inend) + return '\0'; + + if (*inptr == '\"') + inptr++; - return *p; + return inptr < inend ? *inptr : '\0'; } static void @@ -112,7 +121,8 @@ si_free (gpointer key, gpointer val, gpointer user_data) g_free (si->base_url); g_free (si->namespace); - g_byte_array_free (si->junk, TRUE); + if (si->junk) + g_byte_array_free (si->junk, TRUE); g_free (si); } @@ -753,7 +763,8 @@ mailer_upgrade (Bonobo_ConfigDatabase db) } g_free (path); - si->dir_sep = find_dir_sep (si->junk); + if (si->junk) + si->dir_sep = find_dir_sep (si->junk); g_hash_table_insert (imap_sources, si->base_url, si); |