projects
/
claws.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e4dffe9
)
fix bug #2879, 'Plain text mails treated as encrypted'
author
Paul
<paul@claws-mail.org>
Sat, 13 Apr 2013 06:54:52 +0000
(07:54 +0100)
committer
Paul
<paul@claws-mail.org>
Sat, 13 Apr 2013 06:54:52 +0000
(07:54 +0100)
patch by Fabian Keil
src/plugins/pgpinline/pgpinline.c
patch
|
blob
|
history
diff --git
a/src/plugins/pgpinline/pgpinline.c
b/src/plugins/pgpinline/pgpinline.c
index 17523a136c2031c47929bd4ee221c240dad81c46..a1ab2768b54bb708595c6c7cfd7ca19acb942173 100644
(file)
--- a/
src/plugins/pgpinline/pgpinline.c
+++ b/
src/plugins/pgpinline/pgpinline.c
@@
-173,6
+173,22
@@
static gchar *get_part_as_string(MimeInfo *mimeinfo)
return textdata;
}
return textdata;
}
+static gchar *pgpinline_locate_armor_header(gchar *textdata, const gchar *armor_header)
+{
+ gchar *pos;
+
+ pos = strstr(textdata, armor_header);
+ /*
+ * It's only a valid armor header if it's at the
+ * beginning of the buffer or a new line.
+ */
+ if (pos != NULL && (pos == textdata || *(pos-1) == '\n'))
+ {
+ return pos;
+ }
+ return NULL;
+}
+
static gboolean pgpinline_is_signed(MimeInfo *mimeinfo)
{
PrivacyDataPGP *data = NULL;
static gboolean pgpinline_is_signed(MimeInfo *mimeinfo)
{
PrivacyDataPGP *data = NULL;
@@
-364,7
+380,7
@@
static gboolean pgpinline_is_encrypted(MimeInfo *mimeinfo)
if (!textdata)
return FALSE;
if (!textdata)
return FALSE;
- if (!
strst
r(textdata, enc_indicator)) {
+ if (!
pgpinline_locate_armor_heade
r(textdata, enc_indicator)) {
g_free(textdata);
return FALSE;
}
g_free(textdata);
return FALSE;
}
@@
-456,7
+472,7
@@
static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
}
/* Store any part before encrypted text */
}
/* Store any part before encrypted text */
- pos =
strst
r(textdata, begin_indicator);
+ pos =
pgpinline_locate_armor_heade
r(textdata, begin_indicator);
if (pos != NULL && (pos - textdata) > 0) {
if (fwrite(textdata, 1, pos - textdata, dstfp) < pos - textdata) {
FILE_OP_ERROR(fname, "fwrite");
if (pos != NULL && (pos - textdata) > 0) {
if (fwrite(textdata, 1, pos - textdata, dstfp) < pos - textdata) {
FILE_OP_ERROR(fname, "fwrite");
@@
-491,7
+507,7
@@
static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
goto FILE_ERROR;
}
if (pos != NULL) {
goto FILE_ERROR;
}
if (pos != NULL) {
- pos =
strst
r(pos, end_indicator);
+ pos =
pgpinline_locate_armor_heade
r(pos, end_indicator);
if (pos != NULL && *pos != '\0') {
pos += strlen(end_indicator);
if (fwrite(pos, 1, strlen(pos), dstfp) < strlen(pos)) {
if (pos != NULL && *pos != '\0') {
pos += strlen(end_indicator);
if (fwrite(pos, 1, strlen(pos), dstfp) < strlen(pos)) {