diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-09-13 07:25:19 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-09-13 07:25:19 +0000 |
commit | b826872206f83b70591ae8f445e7f531b2d5ef58 (patch) | |
tree | 716a46c99b3b9f9b91ae6e9f9c514386902636df | |
parent | c9865e35f9eaca97abb9369c888535cf007838b4 (diff) |
procmime.c: add more error checking.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1157 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | ChangeLog.ja | 2 | ||||
-rw-r--r-- | libsylph/procmime.c | 6 |
3 files changed, 9 insertions, 1 deletions
@@ -3,6 +3,8 @@ * libsylph/utils.c libsylph/procmime.c: fflush() stream before rewind() to ensure error checking. + procmime_get_part_fp(): check the return value of + procmime_decode_content(). 2006-09-13 diff --git a/ChangeLog.ja b/ChangeLog.ja index f8e47339..815eb1bc 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -3,6 +3,8 @@ * libsylph/utils.c libsylph/procmime.c: エラーチェックを確実にするために rewind() の 前にストリームを fflush() するようにした。 + procmime_get_part_fp(): procmime_decode_content() の戻り値をチェック + するようにした。 2006-09-13 diff --git a/libsylph/procmime.c b/libsylph/procmime.c index 81e5829a..f9dba9d1 100644 --- a/libsylph/procmime.c +++ b/libsylph/procmime.c @@ -989,7 +989,11 @@ gint procmime_get_part_fp(const gchar *outfile, FILE *infp, MimeInfo *mimeinfo) while (fgets(buf, sizeof(buf), infp) != NULL) if (buf[0] == '\r' || buf[0] == '\n') break; - procmime_decode_content(outfp, infp, mimeinfo); + if (procmime_decode_content(outfp, infp, mimeinfo) == NULL) { + fclose(outfp); + g_unlink(outfile); + return -1; + } if (fclose(outfp) == EOF) { FILE_OP_ERROR(outfile, "fclose"); |