[PATCH] : replace and complete the preceding one
- From: Emmanuel <e allaud wanadoo fr>
- To: balsa-list gnome org
- Subject: [PATCH] : replace and complete the preceding one
- Date: Sun, 20 Jan 2002 10:13:22 +0100
Hi all,
finally here are 2 patches that replace the preceding one for
mailbox_pop3.c.
It just replaces 2 relatively unsafe memcpy's for MailThreadMessage
structure, and replace them with safe strncpy.
But I don't think this could cause the weird bug I was hunting :(
Bye
Manu
--- /home/manu/prog/balsa-cvs/balsa/libbalsa/mailbox_pop3.c Sun Jan 6 20:41:09 2002
+++ balsa/libbalsa/mailbox_pop3.c Sun Jan 20 10:07:40 2002
@@ -254,7 +254,7 @@
}
close(tmp_file);
- status = LIBBALSA_MAILBOX_POP3(mailbox)->filter
+ status = m->filter
? libbalsa_fetch_pop_mail_filter (m, progress_cb, uid)
: libbalsa_fetch_pop_mail_direct (m, tmp_path, progress_cb, uid);
@@ -264,14 +264,13 @@
mailbox->name,
pop_get_errstr(status));
- if (LIBBALSA_MAILBOX_POP3(mailbox)->last_popped_uid == NULL ||
- strcmp(LIBBALSA_MAILBOX_POP3(mailbox)->last_popped_uid,
- uid) != 0) {
-
- g_free(LIBBALSA_MAILBOX_POP3(mailbox)->last_popped_uid);
-
- LIBBALSA_MAILBOX_POP3(mailbox)->last_popped_uid =
- g_strdup(uid);
+ if (m->last_popped_uid == NULL)
+ m->last_popped_uid = g_strdup(uid);
+ else
+ if (strcmp(m->last_popped_uid,uid) != 0) {
+ g_free(m->last_popped_uid);
+ m->last_popped_uid = g_strdup(uid);
+ }
#ifdef BALSA_USE_THREADS
threadmsg = g_new(MailThreadMessage, 1);
@@ -300,7 +299,7 @@
#ifdef BALSA_SHOW_ALL
GSList * filters=
- libbalsa_mailbox_filters_when(LIBBALSA_MAILBOX(m)->filters,
+ libbalsa_mailbox_filters_when(mailbox->filters,
FILTER_WHEN_INCOMING);
/* We apply filter if needed */
@@ -339,7 +338,7 @@
message->message_type = MSGMAILTHREAD_MSGINFO;
else
message->message_type = MSGMAILTHREAD_PROGRESS;
- memcpy(message->message_string, msg, strlen(msg) + 1);
+ strncpy(message->message_string, msg, sizeof(message->message_string));
message->num_bytes = prog;
message->tot_bytes = tot;
--- /home/manu/prog/balsa-cvs/balsa/libbalsa/threads.h Mon Nov 26 10:07:01 2001
+++ balsa/libbalsa/threads.h Sun Jan 20 10:09:30 2002
@@ -55,7 +55,7 @@
#define MSGMAILTHREAD( message, type, string) \
message = malloc( sizeof( MailThreadMessage )); \
message->message_type = type; \
- memcpy( message->message_string, string, strlen(string) + 1 ); \
+ strncpy( message->message_string, string, sizeof(message->message_string) ); \
write( mail_thread_pipes[1], (void *) &message, sizeof(void *) );
enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]