aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-13 05:34:15 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-13 05:34:15 +0800
commitbd32e2ed1b24e19885be034457da16990003fbb6 (patch)
tree5150c5de565539cef7db4d4a27c0bc5f9a4d2c66
parent942040b2bf5218f34fd8f4a6aa0592fcb9c8e272 (diff)
downloadgsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar.gz
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar.bz2
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar.lz
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar.xz
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.tar.zst
gsoc2013-evolution-bd32e2ed1b24e19885be034457da16990003fbb6.zip
Since decoding a string doesn't allow strings longer than 65536, truncate
2004-02-12 Jeffrey Stedfast <fejj@ximian.com> * camel-file-utils.c (camel_file_util_encode_string): Since decoding a string doesn't allow strings longer than 65536, truncate strings that are longer than 65536 here. svn path=/trunk/; revision=24728
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-file-utils.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 9812ba2404..a3c56f5ef5 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-12 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-file-utils.c (camel_file_util_encode_string): Since
+ decoding a string doesn't allow strings longer than 65536,
+ truncate strings that are longer than 65536 here.
+
2004-02-09 Not Zed <NotZed@Ximian.com>
** See bug #53978.
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 540fef2739..f4ed4cd22c 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -259,8 +259,10 @@ camel_file_util_encode_string (FILE *out, const char *str)
if (str == NULL)
return camel_file_util_encode_uint32 (out, 1);
-
- len = strlen (str);
+
+ if ((len = strlen (str)) > 65536)
+ len = 65536;
+
if (camel_file_util_encode_uint32 (out, len+1) == -1)
return -1;
if (len == 0 || fwrite (str, len, 1, out) == 1)