aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-object.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-object.c')
-rw-r--r--camel/camel-object.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/camel/camel-object.c b/camel/camel-object.c
index 2af07e15e2..4875774652 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -434,13 +434,15 @@ cobject_state_read(CamelObject *obj, FILE *fp)
CamelArgV *argv;
if (camel_file_util_decode_uint32(fp, &count) == -1
- || count == 0) {
+ || count == 0 || count > 1024) {
/* maybe it was just version 0 afterall */
return 0;
}
-
+
/* we batch up the properties and set them in one go */
- argv = g_malloc(sizeof(*argv) + (count - CAMEL_ARGV_MAX) * sizeof(argv->argv[0]));
+ if (!(argv = g_try_malloc (sizeof (*argv) + (count - CAMEL_ARGV_MAX) * sizeof (argv->argv[0]))))
+ return -1;
+
argv->argc = 0;
for (i=0;i<count;i++) {
if (camel_file_util_decode_uint32(fp, &argv->argv[argv->argc].tag) == -1)