aboutsummaryrefslogtreecommitdiff
path: root/libsylph/recv.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-12 08:46:49 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-12 08:46:49 +0000
commit7b0ca5ffe4f2074dce460b501ba70374bebd5f77 (patch)
treecddb2e0644553b0e77531155719a8389d3407e42 /libsylph/recv.c
parent38511cacbbe75f5d2a68c2679d878ba4f3f3cd28 (diff)
also log IMAP4 literal strings.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@639 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/recv.c')
-rw-r--r--libsylph/recv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libsylph/recv.c b/libsylph/recv.c
index 0b71545c..3d2a7968 100644
--- a/libsylph/recv.c
+++ b/libsylph/recv.c
@@ -45,19 +45,21 @@ gchar *recv_bytes(SockInfo *sock, glong size)
if (size == 0)
return NULL;
- buf = g_malloc(size);
+ buf = g_malloc(size + 1);
do {
gint read_count;
read_count = sock_read(sock, buf + count, size - count);
- if (read_count < 0) {
+ if (read_count <= 0) {
g_free(buf);
return NULL;
}
count += read_count;
} while (count < size);
+ buf[size] = '\0';
+
return buf;
}