2005-01-03 [colin] 0.9.13cvs25
authorColin Leroy <colin@colino.net>
Mon, 3 Jan 2005 08:34:42 +0000 (08:34 +0000)
committerColin Leroy <colin@colino.net>
Mon, 3 Jan 2005 08:34:42 +0000 (08:34 +0000)
* src/pop.c
* src/pop.h
Add data_len member, because we can get NULs from network
Patch by Alfons

ChangeLog.claws
PATCHSETS
configure.ac
src/pop.c
src/pop.h

index c0f1bbbaa9f11744aca26bea92540cfacffb6916..96413ea8c7cf20e52261ff3dcc02f0c24ac28a6f 100644 (file)
@@ -1,3 +1,10 @@
+2005-01-03 [colin]     0.9.13cvs25
+
+       * src/pop.c
+       * src/pop.h
+               Add data_len member, because we can get NULs from network
+               Patch by Alfons
+
 2005-01-01 [colin]     0.9.13cvs24
 
        * src/procmime.c
index 9f1ff32d3d4c1108ce8fede9525289a3356ab4d5..6471b4d42b96cd1b3be0eb54b98b55d9f3ce2048 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.452 -r 1.453 ChangeLog; cvs diff -u -r 1.447 -r 1.448 ChangeLog.jp; cvs diff -u -r 1.54 -r 1.55 NEWS; cvs diff -u -r 1.76 -r 1.77 src/account.c; ) > 0.9.13cvs22.patchset
 ( cvs diff -u -r 1.77 -r 1.78 src/account.c; ) > 0.9.13cvs23.patchset
 ( cvs diff -u -r 1.101 -r 1.102 src/procmime.c; ) > 0.9.13cvs24.patchset
+( cvs diff -u -r 1.72 -r 1.73 src/pop.c; cvs diff -u -r 1.22 -r 1.23 src/pop.h; ) > 0.9.13cvs25.patchset
index a5a423af9fb4e90b7185464b1756e09ae6471e28..3a81a7c4c9217ec03eb90ef816cf906b3e2d605f 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=24
+EXTRA_VERSION=25
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index b58adf54cd296649d96cab0c64259f9b8f0ed084..ce3c75076de770b926a2746391131341e1bf245b 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -339,13 +339,18 @@ static gint pop3_retr_recv(Pop3Session *session, const gchar *data, guint len)
        gint drop_ok;
        MailReceiveData mail_receive_data;
 
-       mail_receive_data.session = session;
-       mail_receive_data.data = g_strndup(data, len);
+       /* NOTE: we allocate a slightly larger buffer with a zero terminator
+        * because some plugins may think that it has a C string. */ 
+       mail_receive_data.session  = session;
+       mail_receive_data.data     = g_new0(gchar, len + 1);
+       mail_receive_data.data_len = len;
+       memcpy(mail_receive_data.data, data, len); 
+       
        hooks_invoke(MAIL_RECEIVE_HOOKLIST, &mail_receive_data);
 
        file = get_tmp_file();
-       if (pop3_write_msg_to_file(file, mail_receive_data.data,
-               strlen(mail_receive_data.data), NULL) < 0) {
+       if (pop3_write_msg_to_file(file, mail_receive_data.data, 
+                                  mail_receive_data.data_len, NULL) < 0) {
                g_free(file);
                g_free(mail_receive_data.data);
                session->error_val = PS_IOERR;
@@ -403,8 +408,13 @@ static gint pop3_top_recv(Pop3Session *session, const gchar *data, guint len)
        MailReceiveData mail_receive_data;
        gchar *partial_notice = NULL;
        
-       mail_receive_data.session = session;
-       mail_receive_data.data = g_strndup(data, len);
+       /* NOTE: we allocate a slightly larger buffer with a zero terminator
+        * because some plugins may think that it has a C string. */ 
+       mail_receive_data.session  = session;
+       mail_receive_data.data     = g_new0(gchar, len + 1);
+       mail_receive_data.data_len = len;
+       memcpy(mail_receive_data.data, data, len);
+       
        hooks_invoke(MAIL_RECEIVE_HOOKLIST, &mail_receive_data);
 
        partial_notice = g_strdup_printf("SC-Marked-For-Download: 0\n"
@@ -418,7 +428,8 @@ static gint pop3_top_recv(Pop3Session *session, const gchar *data, guint len)
                                         session->msg[session->cur_msg].size);
        file = get_tmp_file();
        if (pop3_write_msg_to_file(file, mail_receive_data.data,
-               strlen(mail_receive_data.data), partial_notice) < 0) {
+                                  mail_receive_data.data_len,  
+                                  partial_notice) < 0) {
                g_free(file);
                g_free(mail_receive_data.data);
                session->error_val = PS_IOERR;
index 8b4d9b1f596855566ed0d835c60f84d47f96b909..a63af6f6ea1ba70ad9d72031041aa60e0a1de9f2 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -40,6 +40,7 @@ struct _MailReceiveData
 {
        Pop3Session *session;
        char *data;
+       guint data_len;
 };
 typedef struct _MailReceiveData        MailReceiveData;