aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-06 06:23:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-06 06:23:04 +0000
commit9bb800a49acaef0dc19916e5ae00c941292d2515 (patch)
tree4aee0dd046aa1af838209c81abe3af823b0c53a3
parentcea367a9403bbc0da0ac4be390cb09a7b471c51b (diff)
fixed a crash when printing a message with empty Subject, From, and To.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1266 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.ja11
-rw-r--r--libsylph/codeconv.c16
-rw-r--r--libsylph/procmsg.c15
4 files changed, 47 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 87df7ff3..137e6030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-11-06
+
+ * libsylph/procmsg.c: procmsg_print_message(): fixed a crash when
+ printing a message with empty Subject, From, and To (thanks to
+ Jonathan Woithe).
+ * libsylph/codeconv.c:
+ conv_convert()
+ conv_codeset_strdup_full()
+ conv_iconv_strdup_with_cd(): return NULL if input string is NULL
+ (fixes crashes with NULL strings).
+
2006-11-02
* libsylph/folder.[ch]
diff --git a/ChangeLog.ja b/ChangeLog.ja
index c8e0d0ca..b1913ecd 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,14 @@
+2006-11-06
+
+ * libsylph/procmsg.c: procmsg_print_message(): 空の Subject, From, To
+ があるメッセージを印刷するとクラッシュするバグを修正 (Jonathan
+ Woithe さん thanks)。
+ * libsylph/codeconv.c:
+ conv_convert()
+ conv_codeset_strdup_full()
+ conv_iconv_strdup_with_cd(): 入力文字列が NULL の場合 NULL を返す
+ ようにした(NULL 文字列によるクラッシュを修正).
+
2006-11-02
* libsylph/folder.[ch]
diff --git a/libsylph/codeconv.c b/libsylph/codeconv.c
index c05a1db5..6a16513c 100644
--- a/libsylph/codeconv.c
+++ b/libsylph/codeconv.c
@@ -1328,7 +1328,9 @@ void conv_code_converter_destroy(CodeConverter *conv)
gchar *conv_convert(CodeConverter *conv, const gchar *inbuf)
{
- if (conv->code_conv_func != conv_noconv)
+ if (!inbuf)
+ return NULL;
+ else if (conv->code_conv_func != conv_noconv)
return conv->code_conv_func(inbuf, NULL);
else
return conv_iconv_strdup
@@ -1342,6 +1344,12 @@ gchar *conv_codeset_strdup_full(const gchar *inbuf,
{
CodeConvFunc conv_func;
+ if (!inbuf) {
+ if (error)
+ *error = 0;
+ return NULL;
+ }
+
src_encoding = conv_get_fallback_for_private_encoding(src_encoding);
conv_func = conv_get_code_conv_func(src_encoding, dest_encoding);
@@ -1486,6 +1494,12 @@ gchar *conv_iconv_strdup_with_cd(const gchar *inbuf, iconv_t cd, gint *error)
size_t len;
gint error_ = 0;
+ if (!inbuf) {
+ if (error)
+ *error = 0;
+ return NULL;
+ }
+
inbuf_p = inbuf;
in_size = strlen(inbuf);
in_left = in_size;
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index 6d6b8bb2..3d69f015 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -1387,11 +1387,16 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline,
body++;
}
- locale_str = conv_codeset_strdup
- (body, CS_INTERNAL, conv_get_locale_charset_str());
- fprintf(prfp, "%s: %s\n", hdr->name,
- locale_str ? locale_str : body);
- g_free(locale_str);
+ if (body && *body != '\0') {
+ locale_str = conv_codeset_strdup
+ (body, CS_INTERNAL,
+ conv_get_locale_charset_str());
+ fprintf(prfp, "%s: %s\n", hdr->name,
+ locale_str ? locale_str : body);
+ g_free(locale_str);
+ } else {
+ fprintf(prfp, "%s: (none)\n", hdr->name);
+ }
}
procheader_header_array_destroy(headers);