From b826872206f83b70591ae8f445e7f531b2d5ef58 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 13 Sep 2006 07:25:19 +0000 Subject: procmime.c: add more error checking. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1157 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 2 ++ ChangeLog.ja | 2 ++ libsylph/procmime.c | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 25be8c88..71b4031e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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"); -- cgit v1.2.3