Buffer mixup

Use one (small) buffer long enough to hold a date.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2017-12-09 23:53:20 +01:00 committed by Lukas Fleischer
parent 223810cf0e
commit fa353e5eb7

View File

@ -540,8 +540,7 @@ void ui_day_item_pipe(void)
*/ */
void ui_day_item_add(void) void ui_day_item_add(void)
{ {
#define LTIME 16 #define LTIME 17
#define LDUR 12
const char *mesg_1 = const char *mesg_1 =
_("Enter start time ([hh:mm] or [hhmm]), leave blank for an all-day event:"); _("Enter start time ([hh:mm] or [hhmm]), leave blank for an all-day event:");
const char *mesg_2 = const char *mesg_2 =
@ -555,7 +554,7 @@ void ui_day_item_add(void)
const char *format_message_2 = _("Invalid time or duration."); const char *format_message_2 = _("Invalid time or duration.");
const char *format_message_3 = _("Invalid date: end time must come after start time."); const char *format_message_3 = _("Invalid date: end time must come after start time.");
const char *enter_str = _("Press [Enter] to continue"); const char *enter_str = _("Press [Enter] to continue");
char item_time[LDUR] = ""; char item_time[LTIME] = "";
char item_mesg[BUFSIZ] = ""; char item_mesg[BUFSIZ] = "";
time_t start = date2sec(*ui_calendar_get_slctd_day(), 0, 0), end, saved = start; time_t start = date2sec(*ui_calendar_get_slctd_day(), 0, 0), end, saved = start;
unsigned dur; unsigned dur;
@ -592,7 +591,7 @@ void ui_day_item_add(void)
for (;;) { for (;;) {
int early = 0; int early = 0;
status_mesg(mesg_2, ""); status_mesg(mesg_2, "");
if (getstring(win[STA].p, item_time, LDUR, 0, 1) == if (getstring(win[STA].p, item_time, LTIME, 0, 1) ==
GETSTRING_ESC) GETSTRING_ESC)
return; return;
if (*item_time == '?') { if (*item_time == '?') {