[evolution-data-server] camel: Fix ordering of parameters to fread()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] camel: Fix ordering of parameters to fread()
- Date: Mon, 3 Nov 2014 22:21:00 +0000 (UTC)
commit 6a69786dee79e735039a1b84472544a55f88f8f9
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Nov 1 13:51:57 2014 +0000
camel: Fix ordering of parameters to fread()
fread() takes two integer parameters: size and nmemb. size should always
be constant, as it is a structure size. nmemb may vary. Using these two
parameters the correct way around means the return value is consistently
related to nmemb, and static analysers such as Coverity can perform
taint tests on the values passed to size.
Coverity issue: #1061517
https://bugzilla.gnome.org/show_bug.cgi?id=730381
camel/camel-file-utils.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index af5f33c..4e352d0 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -306,7 +306,7 @@ camel_file_util_decode_string (FILE *in,
}
ret = g_malloc (len + 1);
- if (len > 0 && fread (ret, len, 1, in) != 1) {
+ if (len > 0 && fread (ret, sizeof (gchar), len, in) != len) {
g_free (ret);
*str = NULL;
return -1;
@@ -379,7 +379,7 @@ camel_file_util_decode_fixed_string (FILE *in,
}
ret = g_malloc (len + 1);
- if (len > 0 && fread (ret, len, 1, in) != 1) {
+ if (len > 0 && fread (ret, sizeof (gchar), len, in) != len) {
g_free (ret);
*str = NULL;
return -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]