commit 943c87cd311268d9c9d0766197c2ede061aa58ad
parent dd061389c3c09cc668fd4cf272a55c7290deb1e9
Author: wwp <subscript@free.fr>
Date: Sun, 26 Sep 2021 19:30:14 +0200
Fix CID 1491354: null ptr dereference,
add warnings in case of unexpected filename encoding conversion or copy failures.
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/summaryview.c b/src/summaryview.c
@@ -7583,12 +7583,18 @@ static void summary_drag_data_get(GtkWidget *widget,
san_subject, msginfo->msgnum);
g_free(san_subject);
san_subject = g_filename_from_utf8(dest, -1, NULL, NULL, NULL);
- g_free(dest);
- dest = san_subject;
- if (copy_file(tmp2, dest, TRUE) == 0) {
- g_free(tmp2);
- tmp2 = dest;
+ if (!san_subject) {
+ g_warning("failed to convert encoding of file name: %s", dest);
+ } else {
+ g_free(dest);
+ dest = san_subject;
}
+ if (copy_file(tmp2, dest, TRUE) < 0) {
+ g_warning("summary_drag_data_get: can't copy %s to %s",
+ tmp2, dest);
+ }
+ g_free(tmp2);
+ tmp2 = dest;
}
tmp1 = g_filename_to_uri(tmp2, NULL, NULL);
g_free(tmp2);