diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2019-07-25 12:06:07 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2019-07-25 12:06:07 +0100 |
commit | f3ebb786e451da973560f1c9d8cdb151d25108b5 (patch) | |
tree | 8fd69711b9a429b20a1b8b1d18ae63b726cb9723 /src/exim_monitor | |
parent | 21aa05977abff1eaa69bb97ef99080220915f7c0 (diff) | |
download | exim4-f3ebb786e451da973560f1c9d8cdb151d25108b5.tar.gz |
Track tainted data and refuse to expand it
Diffstat (limited to 'src/exim_monitor')
-rw-r--r-- | src/exim_monitor/em_log.c | 11 | ||||
-rw-r--r-- | src/exim_monitor/em_main.c | 4 | ||||
-rw-r--r-- | src/exim_monitor/em_menu.c | 4 | ||||
-rw-r--r-- | src/exim_monitor/em_queue.c | 14 | ||||
-rw-r--r-- | src/exim_monitor/em_strip.c | 2 | ||||
-rw-r--r-- | src/exim_monitor/em_version.c | 6 | ||||
-rw-r--r-- | src/exim_monitor/em_xs.c | 4 |
7 files changed, 23 insertions, 22 deletions
diff --git a/src/exim_monitor/em_log.c b/src/exim_monitor/em_log.c index 52eef6b20..1e1dc7c04 100644 --- a/src/exim_monitor/em_log.c +++ b/src/exim_monitor/em_log.c @@ -227,7 +227,7 @@ if (LOG != NULL) { uschar *id; uschar *p = buffer; - void *reset_point; + rmark reset_point; int length = Ustrlen(buffer); int i; @@ -240,7 +240,7 @@ if (LOG != NULL) it for various regular expression matches and take appropriate action. Get the current store point so we can reset to it. */ - reset_point = store_get(0); + reset_point = store_mark(); /* First, update any stripchart data values, noting that the zeroth stripchart is the queue length, which is handled elsewhere, and the @@ -364,9 +364,10 @@ link count of zero on the currently open file. */ if (log_datestamping) { uschar log_file_wanted[256]; - /* Do *not* use "%s" here, we need the %D datestamp in the log_file to - * be expanded! */ - string_format(log_file_wanted, sizeof(log_file_wanted), CS log_file); + /* Do *not* use "%s" here, we need the %D datestamp in the log_file string to + be expanded. The trailing NULL arg is to quieten preprocessors that need at + least one arg for a variadic set in a macro. */ + string_format(log_file_wanted, sizeof(log_file_wanted), CS log_file, NULL); if (Ustrcmp(log_file_wanted, log_file_open) != 0) { if (LOG != NULL) diff --git a/src/exim_monitor/em_main.c b/src/exim_monitor/em_main.c index 7aa760eb3..9c7f442e5 100644 --- a/src/exim_monitor/em_main.c +++ b/src/exim_monitor/em_main.c @@ -613,7 +613,7 @@ message_subdir[1] = 0; constructing file names and things. This call will initialize the store_get() function. */ -big_buffer = store_get(big_buffer_size); +big_buffer = store_get(big_buffer_size, FALSE); /* Set up the version string and date and output them */ @@ -655,7 +655,7 @@ if (log_file[0] != 0) { /* Do *not* use "%s" here, we need the %D datestamp in the log_file to be expanded! */ - (void)string_format(log_file_open, sizeof(log_file_open), CS log_file); + (void)string_format(log_file_open, sizeof(log_file_open), CS log_file, NULL); log_datestamping = string_datestamp_offset >= 0; LOG = fopen(CS log_file_open, "r"); diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c index 31ce1a371..92e0b351b 100644 --- a/src/exim_monitor/em_menu.c +++ b/src/exim_monitor/em_menu.c @@ -651,7 +651,7 @@ static void headersAction(Widget w, XtPointer client_data, XtPointer call_data) uschar buffer[256]; header_line *h, *next; Widget text = text_create(US client_data, text_depth); -void *reset_point; +rmark reset_point; w = w; /* Keep picky compilers happy */ call_data = call_data; @@ -659,7 +659,7 @@ call_data = call_data; /* Remember the point in the dynamic store so we can recover to it afterwards. Then use Exim's function to read the header. */ -reset_point = store_get(0); +reset_point = store_mark(); sprintf(CS buffer, "%s-H", US client_data); if (spool_read_header(buffer, TRUE, FALSE) != spool_read_OK) diff --git a/src/exim_monitor/em_queue.c b/src/exim_monitor/em_queue.c index c8d9a40fc..f121527cc 100644 --- a/src/exim_monitor/em_queue.c +++ b/src/exim_monitor/em_queue.c @@ -138,7 +138,7 @@ acl_var_create(uschar *name) { tree_node *node, **root; root = (name[0] == 'c')? &acl_var_c : &acl_var_m; -node = store_get(sizeof(tree_node) + Ustrlen(name)); +node = store_get(sizeof(tree_node) + Ustrlen(name), FALSE); Ustrcpy(node->name, name); node->data.ptr = NULL; (void)tree_insertnode(root, node); @@ -156,7 +156,7 @@ set_up(uschar *name, int dir_char) { int i, rc, save_errno; struct stat statdata; -void *reset_point; +rmark reset_point; uschar *p; queue_item *q = (queue_item *)store_malloc(sizeof(queue_item)); uschar buffer[256]; @@ -182,7 +182,7 @@ Before reading the header remember the position in the dynamic store so that we can recover the store into which the header is read. All data read by spool_read_header that is to be preserved is copied into malloc store. */ -reset_point = store_get(0); +reset_point = store_mark(); message_size = 0; message_subdir[0] = dir_char; sprintf(CS buffer, "%s-H", name); @@ -224,9 +224,9 @@ if (rc != spool_read_OK) if (Ustat(big_buffer, &statbuf) == 0) msg = string_sprintf("*** Format error in spool file: size = %d ***", statbuf.st_size); - else msg = string_sprintf("*** Format error in spool file ***"); + else msg = US"*** Format error in spool file ***"; } - else msg = string_sprintf("*** Cannot read spool file ***"); + else msg = US"*** Cannot read spool file ***"; if (rc == spool_read_hdrerror) { @@ -614,7 +614,7 @@ static void update_recipients(queue_item *p) { int i; FILE *jread; -void *reset_point; +rmark reset_point; struct stat statdata; uschar buffer[1024]; @@ -634,7 +634,7 @@ if (!(jread = fopen(CS buffer, "r"))) /* Get the contents of the header file; if any problem, just give up. Arrange to recover the dynamic store afterwards. */ -reset_point = store_get(0); +reset_point = store_mark(); sprintf(CS buffer, "%s-H", p->name); if (spool_read_header(buffer, FALSE, TRUE) != spool_read_OK) { diff --git a/src/exim_monitor/em_strip.c b/src/exim_monitor/em_strip.c index 2a5f0b84e..03864d290 100644 --- a/src/exim_monitor/em_strip.c +++ b/src/exim_monitor/em_strip.c @@ -141,7 +141,7 @@ while (thresholds[i] > 0) thresh : stripchart_midmax[num]; if (newmax == 10) sprintf(CS buffer, "%s", stripchart_name[num]); else sprintf(CS buffer, "%s x%d", stripchart_name[num], newmax/10); - if (size_stripchart != NULL && num == 1) Ustrcat(buffer, "%"); + if (size_stripchart != NULL && num == 1) Ustrcat(buffer, US"%"); xs_SetValues(stripchart_label[num], 1, "label", buffer); oldmax = stripchart_max[num]; stripchart_max[num] = newmax; diff --git a/src/exim_monitor/em_version.c b/src/exim_monitor/em_version.c index e5a4ebbb0..52c55a4a3 100644 --- a/src/exim_monitor/em_version.c +++ b/src/exim_monitor/em_version.c @@ -34,7 +34,7 @@ version_date[0] = 0; Ustrncat(version_date, EXIM_BUILD_DATE_OVERRIDE, 31); #else -Ustrcpy(today, __DATE__); +Ustrcpy(today, US __DATE__); if (today[4] == ' ') i = 1; today[3] = today[6] = '-'; @@ -43,8 +43,8 @@ version_date[0] = 0; Ustrncat(version_date, today+4+i, 3-i); Ustrncat(version_date, today, 4); Ustrncat(version_date, today+7, 4); -Ustrcat(version_date, " "); -Ustrcat(version_date, __TIME__); +Ustrcat(version_date, US" "); +Ustrcat(version_date, US __TIME__); #endif } diff --git a/src/exim_monitor/em_xs.c b/src/exim_monitor/em_xs.c index b145fb993..ee91f7c15 100644 --- a/src/exim_monitor/em_xs.c +++ b/src/exim_monitor/em_xs.c @@ -30,7 +30,7 @@ void xs_SetValues(Widget w, Cardinal num_args, ...) { int i; va_list ap; -Arg *aa = (num_args > 15)? (Arg *)malloc(num_args*sizeof(Arg)) : xs_temparg; +Arg *aa = (num_args > 15)? store_malloc(num_args*sizeof(Arg)) : xs_temparg; va_start(ap, num_args); for (i = 0; i < num_args; i++) { @@ -39,7 +39,7 @@ for (i = 0; i < num_args; i++) } va_end(ap); XtSetValues(w, aa, num_args); -if (num_args > 15) free(aa); +if (num_args > 15) store_free(aa); } /* End of em_xs.c */ |