$Log$
+ Revision 573.125 2001/04/14 04:26:44 ajc
+ * Fixed an unterminated string bug in IMAP APPEND. Storing messages should
+ work now.
+
Revision 573.124 2001/04/10 01:04:10 ajc
* Finished coding IMAP APPEND. It works, but there's a bug in it somewhere
that is corrupting the memory.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
}
imap_free_transmitted_message(); /* just in case. */
- IMAP->transmitted_message = mallok(literal_length);
+ IMAP->transmitted_message = mallok(literal_length + 1);
if (IMAP->transmitted_message == NULL) {
cprintf("%s NO Cannot allocate memory.\r\n", parms[0]);
return;
cprintf("+ Transmit message now.\r\n");
ret = client_read(IMAP->transmitted_message, literal_length);
+ IMAP->transmitted_message[literal_length] = 0;
if (ret != 1) {
cprintf("%s NO Read failed.\r\n", parms[0]);
return;
lprintf(9, "Converting message...\n");
msg = convert_internet_message(IMAP->transmitted_message);
+ IMAP->transmitted_message = NULL;
+ IMAP->transmitted_length = 0;
/* If the user is locally authenticated, FORCE the From: header to
* show up as the real sender. FIXME do we really want to do this?
/*
* Convert an RFC822 message (headers + body) to a CtdlMessage structure.
+ * NOTE: the supplied buffer becomes part of the CtdlMessage structure, and
+ * will be deallocated when CtdlFreeMessage() is called. Therefore, the
+ * supplied buffer should be DEREFERENCED. It should not be freed or used
+ * again.
*/
struct CtdlMessage *convert_internet_message(char *rfc822) {