diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-16 15:30:57 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-16 15:32:22 +0000 |
commit | 8d468c4c169a7519d5b172cc049b1d8cc7b1c343 (patch) | |
tree | 31317ff569439cf95eab611b4dda9b94f4319b0c | |
parent | 6e3b198d9efa70de98409fbb78b9f83257b2101c (diff) |
tidying: coverity issues
-rw-r--r-- | src/exim_monitor/em_menu.c | 3 | ||||
-rw-r--r-- | src/src/sieve.c | 42 | ||||
-rw-r--r-- | src/src/spool_mbox.c | 3 |
3 files changed, 24 insertions, 24 deletions
diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c index 6975e709d..81df0d37c 100644 --- a/src/exim_monitor/em_menu.c +++ b/src/exim_monitor/em_menu.c @@ -556,6 +556,7 @@ static void addrecipAction(Widget w, XtPointer client_data, XtPointer call_data) 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""); @@ -572,6 +573,7 @@ static void markdelAction(Widget w, XtPointer client_data, XtPointer call_data) 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""); @@ -602,6 +604,7 @@ uschar *sender; 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"; diff --git a/src/src/sieve.c b/src/src/sieve.c index bda482fd1..8f98aebab 100644 --- a/src/src/sieve.c +++ b/src/src/sieve.c @@ -232,6 +232,9 @@ uschar *new = NULL; 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; @@ -245,54 +248,47 @@ for (pass=0; pass<=1; ++pass) 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; diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index 63542ebef..95e71b9c9 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -165,7 +165,8 @@ if (!spool_mbox_ok) (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; } |