w = w; /* Keep picky compilers happy */
call_data = call_data;
Ustrncpy(actioned_message, client_data, 24);
+actioned_message[23] = '\0';
action_required = US"-Mar";
dialog_ref_widget = menushell;
create_dialog(US"Recipient address to add?", US"");
w = w; /* Keep picky compilers happy */
call_data = call_data;
Ustrncpy(actioned_message, client_data, 24);
+actioned_message[23] = '\0';
action_required = US"-Mmd";
dialog_ref_widget = menushell;
create_dialog(US"Recipient address to mark delivered?", US"");
w = w; /* Keep picky compilers happy */
call_data = call_data;
Ustrncpy(actioned_message, client_data, 24);
+actioned_message[23] = '\0';
q = find_queue(actioned_message, queue_noop, 0);
sender = !q ? US"" : q->sender[0] == 0 ? US"<>" : q->sender;
action_required = US"-Mes";
uschar ch;
size_t line;
+/* Two passes: one to count output allocation size, second
+to do the encoding */
+
for (pass=0; pass<=1; ++pass)
{
line=0;
for (start=src->character,end=start+src->length; start<end; ++start)
{
ch=*start;
- if (line>=73)
+ if (line>=73) /* line length limit */
{
if (pass==0)
dst->length+=2;
else
{
- *new++='=';
+ *new++='='; /* line split */
*new++='\n';
}
line=0;
}
- if
- (
- (ch>=33 && ch<=60)
- || (ch>=62 && ch<=126)
- ||
- (
- (ch==9 || ch==32)
- && start+2<end
- && (*(start+1)!='\r' || *(start+2)!='\n')
- )
- )
+ if ( (ch>='!' && ch<='<')
+ || (ch>='>' && ch<='~')
+ || ( (ch=='\t' || ch==' ')
+ && start+2<end
+ && (*(start+1)!='\r' || *(start+2)!='\n') /* CRLF */
+ )
+ )
{
if (pass==0)
++dst->length;
else
- *new++=*start;
+ *new++=*start; /* copy char */
++line;
}
- else if (ch=='\r' && start+1<end && *(start+1)=='\n')
+ else if (ch=='\r' && start+1<end && *(start+1)=='\n') /* CRLF */
{
if (pass==0)
- {
++dst->length;
- line=0;
- }
else
- *new++='\n';
- line=0; /*XXX jgh: questionabale indent; probable BUG */
- ++start;
+ *new++='\n'; /* NL */
+ line=0;
+ ++start; /* consume extra input char */
}
else
{
if (pass==0)
dst->length+=3;
else
- {
- sprintf(CS new,"=%02X",ch);
+ { /* encoded char */
+ new += sprintf(CS new,"=%02X",ch);
new+=3;
}
line+=3;
(void)fclose(mbox_file);
mbox_file = NULL;
- Ustrncpy(spooled_message_id, message_id, MESSAGE_ID_LENGTH+1);
+ Ustrncpy(spooled_message_id, message_id, sizeof(spooled_message_id));
+ spooled_message_id[sizeof(spooled_message_id)-1] = '\0';
spool_mbox_ok = 1;
}