X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/6e3b198d9efa70de98409fbb78b9f83257b2101c..a2da3176aa39ec9aa5ae495e5a6d533477f871aa:/src/exim_monitor/em_menu.c diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c index 6975e709d..ccdfa05ba 100644 --- a/src/exim_monitor/em_menu.c +++ b/src/exim_monitor/em_menu.c @@ -2,7 +2,7 @@ * Exim Monitor * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2009 */ +/* Copyright (c) University of Cambridge 1995 - 2016 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -148,10 +148,10 @@ call_data = call_data; for (i = 0; i < (spool_is_split? 2:1); i++) { message_subdir[0] = (i != 0)? ((uschar *)client_data)[5] : 0; - sprintf(CS buffer, "%s/msglog/%s/%s", spool_directory, message_subdir, - (uschar *)client_data); - f = fopen(CS buffer, "r"); - if (f != NULL) break; + snprintf(CS buffer, sizeof(buffer), "%s/msglog/%s/%s/%s", + spool_directory, queue_name, message_subdir, (uschar *)client_data); + if ((f = fopen(CS buffer, "r"))) + break; } if (f == NULL) @@ -181,11 +181,11 @@ call_data = call_data; for (i = 0; i < (spool_is_split? 2:1); i++) { - message_subdir[0] = (i != 0)? ((uschar *)client_data)[5] : 0; - sprintf(CS buffer, "%s/input/%s/%s-D", spool_directory, message_subdir, - (uschar *)client_data); - f = fopen(CS buffer, "r"); - if (f != NULL) break; + message_subdir[0] = i != 0 ? ((uschar *)client_data)[5] : 0; + snprintf(CS buffer, sizeof(buffer), "%s/input/%s/%s/%s-D", + spool_directory, queue_name, message_subdir, (uschar *)client_data); + if ((f = fopen(CS buffer, "r"))) + break; } if (f == NULL) @@ -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";