aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-file-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-file-utils.c')
-rw-r--r--camel/camel-file-utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 1b0fe65dbb..1411873cc4 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -237,7 +237,7 @@ camel_file_util_encode_string (FILE *out, const char *str)
len = strlen (str);
if (camel_file_util_encode_uint32 (out, len+1) == -1)
return -1;
- if (fwrite (str, len, 1, out) == 1)
+ if (len == 0 || fwrite (str, len, 1, out) == 1)
return 0;
return -1;
}
@@ -269,7 +269,7 @@ camel_file_util_decode_string (FILE *in, char **str)
}
ret = g_malloc (len+1);
- if (fread (ret, len, 1, in) != 1) {
+ if (len > 0 && fread (ret, len, 1, in) != 1) {
g_free (ret);
*str = NULL;
return -1;