[evolution-data-server] camel: Fix ordering of parameters to fwrite()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] camel: Fix ordering of parameters to fwrite()
- Date: Mon, 3 Nov 2014 22:21:05 +0000 (UTC)
commit f81b1ec80ae382d83861e8afa4bd13f604131acf
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Nov 3 15:59:42 2014 +0000
camel: Fix ordering of parameters to fwrite()
fwrite() 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.
https://bugzilla.gnome.org/show_bug.cgi?id=730381
camel/camel-block-file.c | 2 +-
camel/camel-file-utils.c | 4 ++--
camel/providers/imapx/camel-imapx-utils.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c
index 3fe90a7..71f4c4f 100644
--- a/camel/camel-block-file.c
+++ b/camel/camel-block-file.c
@@ -1043,7 +1043,7 @@ camel_key_file_new (const gchar *path,
fseek (kf->fp, 0, SEEK_END);
last = ftell (kf->fp);
if (last == 0) {
- fwrite (version, 8, 1, kf->fp);
+ fwrite (version, sizeof (gchar), 8, kf->fp);
last += 8;
}
kf->last = last;
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 4e352d0..8206bf3 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -273,7 +273,7 @@ camel_file_util_encode_string (FILE *out,
if (camel_file_util_encode_uint32 (out, len + 1) == -1)
return -1;
- if (len == 0 || fwrite (str, len, 1, out) == 1)
+ if (len == 0 || fwrite (str, sizeof (gchar), len, out) == len)
return 0;
return -1;
}
@@ -347,7 +347,7 @@ camel_file_util_encode_fixed_string (FILE *out,
buf = g_malloc0 (len);
g_strlcpy (buf, str, len);
- if (fwrite (buf, len, 1, out) == len)
+ if (fwrite (buf, sizeof (gchar), len, out) == len)
retval = 0;
g_free (buf);
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 7833039..34d4a90 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -1559,19 +1559,19 @@ imapx_dump_fetch (struct _fetch_info *finfo)
if (finfo->body != NULL) {
g_print ("Body content:\n");
data = g_bytes_get_data (finfo->body, &size);
- fwrite (data, size, 1, stdout);
+ fwrite (data, sizeof (gchar), size, stdout);
}
if (finfo->text != NULL) {
g_print ("Text content:\n");
data = g_bytes_get_data (finfo->text, &size);
- fwrite (data, size, 1, stdout);
+ fwrite (data, sizeof (gchar), size, stdout);
}
if (finfo->header != NULL) {
g_print ("Header content:\n");
data = g_bytes_get_data (finfo->header, &size);
- fwrite (data, size, 1, stdout);
+ fwrite (data, sizeof (gchar), size, stdout);
}
if (finfo->minfo != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]