evolution-data-server/evolution-data-server-1.8.0-fix-camel-malloc.patch

33 lines
1.2 KiB
Diff

--- evolution-data-server-1.8.0/camel/camel-object.c.fix-camel-malloc 2006-09-26 16:26:00.000000000 -0400
+++ evolution-data-server-1.8.0/camel/camel-object.c 2006-09-26 16:35:32.000000000 -0400
@@ -455,9 +455,13 @@
/* maybe it was just version 0 afterall */
return 0;
}
+
+ count = MIN(count, CAMEL_ARGV_MAX);
/* we batch up the properties and set them in one go */
- if (!(argv = g_try_malloc ((gulong)(sizeof (*argv) + (count - CAMEL_ARGV_MAX) * sizeof (argv->argv[0])))))
+ argv = g_try_malloc(sizeof(CamelArgV) -
+ ((CAMEL_ARGV_MAX - count) * sizeof(CamelArg)));
+ if (argv == NULL)
return -1;
argv->argc = 0;
@@ -536,9 +540,12 @@
we also need an argv to store the results - bit messy */
count = g_slist_length(props);
+ count = MIN(count, CAMEL_ARGV_MAX);
- arggetv = g_malloc0(sizeof(*arggetv) + (count - CAMEL_ARGV_MAX) * sizeof(arggetv->argv[0]));
- argv = g_malloc0(sizeof(*argv) + (count - CAMEL_ARGV_MAX) * sizeof(argv->argv[0]));
+ arggetv = g_malloc0(sizeof(CamelArgGetV) -
+ ((CAMEL_ARGV_MAX - count) * sizeof(CamelArgGet)));
+ argv = g_malloc0(sizeof(CamelArgV) -
+ ((CAMEL_ARGV_MAX - count) * sizeof(CamelArg)));
l = props;
i = 0;
while (l) {