Fixed crash with '%' in attribute and 'Preset on reply <attr> = Re: $sttr'

SVN revision: 2339
This commit is contained in:
Stefan Ritt 2010-11-16 13:42:43 +00:00
parent e3777e775a
commit 54fdb57fad

View File

@ -9355,11 +9355,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */
(breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && strchr(preset, '#')) {
/* get index */
@ -9367,6 +9362,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
@ -9376,11 +9375,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (orig_tag[0] == 0) {
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9388,8 +9382,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
}
@ -9399,11 +9396,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9411,8 +9403,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
@ -9421,11 +9416,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9433,8 +9423,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
@ -9463,11 +9456,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */
(breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9475,8 +9463,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
@ -9485,11 +9476,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9497,8 +9483,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
@ -9507,11 +9496,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
@ -9519,8 +9503,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib, (attr_flags[index] & (AF_DATE | AF_DATETIME))
== 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
strcpy(attrib[index], preset);
}
}
}
@ -22252,7 +22239,6 @@ void submit_elog(LOGBOOK * lbs)
get_auto_index(lbs, i, subst_str, str, sizeof(str));
strcpy(subst_str, str);
}
strcpy(attrib[i], subst_str);
}
}