diff --git a/src/elogd.cxx b/src/elogd.cxx index ad522631..18eea018 100755 --- a/src/elogd.cxx +++ b/src/elogd.cxx @@ -3453,7 +3453,7 @@ void retrieve_domain(char *ret, int size) { /*-------------------------------------------------------------------*/ void retrieve_email_from(LOGBOOK *lbs, char *ret, char *ret_name, char attrib[MAX_N_ATTR][NAME_LENGTH]) { - char email_from[256], email_from_name[256], str[256], *p, login_name[256], + char email_from[1000], email_from_name[1300], str[256], *p, login_name[256], slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH], full_name[256], user_email[256]; int i; @@ -8663,7 +8663,7 @@ void strencode2(char *b, const char *text, int size) { int build_subst_list(LOGBOOK *lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], char attrib[][NAME_LENGTH], BOOL format_date) { int i; - char str[NAME_LENGTH], format[256], full_name[256], user_email[256]; + char str[NAME_LENGTH+100], format[256], full_name[256], user_email[256]; time_t t; struct tm *ts; @@ -8837,7 +8837,7 @@ BOOL get_password_file(LOGBOOK *lbs, char *file_name, int size) { /*------------------------------------------------------------------*/ void show_change_pwd_page(LOGBOOK *lbs) { - char str[256], config[256], old_pwd[256], new_pwd[256], new_pwd2[256], user[256], auth[32], error_str[256]; + char str[1000], config[256], old_pwd[256], new_pwd[256], new_pwd2[256], user[256], auth[32], error_str[256]; int wrong_pwd; /* otherwise calls with null lbs which make this procedure crash */ if (lbs == NULL) @@ -9055,7 +9055,7 @@ void get_auto_index(LOGBOOK *lbs, int index, char *format, char *retstr, int siz /*------------------------------------------------------------------*/ BOOL is_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *owner) { - char str[NAME_LENGTH], preset[NAME_LENGTH], full_name[NAME_LENGTH]; + char str[NAME_LENGTH+100], preset[NAME_LENGTH], full_name[NAME_LENGTH], attr[NAME_LENGTH]; int i; /* check if current user is admin */ @@ -9064,7 +9064,8 @@ BOOL is_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *owner) /* search attribute which contains short_name of author */ for (i = 0; i < lbs->n_attr; i++) { - sprintf(str, "Preset %s", attr_list[i]); + strlcpy(attr, attr_list[i], sizeof(attr)); + sprintf(str, "Preset %s", attr); if (getcfg(lbs->name, str, preset, sizeof(preset))) { if (strstr(preset, "$short_name")) { if (!isparam("unm") || strstr(attrib[i], getparam("unm")) == NULL) { @@ -9081,7 +9082,8 @@ BOOL is_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *owner) if (isparam("unm")) { get_full_name(lbs, getparam("unm"), full_name); for (i = 0; i < lbs->n_attr; i++) { - sprintf(str, "Preset %s", attr_list[i]); + strlcpy(attr, attr_list[i], sizeof(attr)); + sprintf(str, "Preset %s", attr); if (getcfg(lbs->name, str, preset, sizeof(preset))) { if (strstr(preset, "$long_name")) { if (strstr(attrib[i], full_name) == NULL) { @@ -9101,12 +9103,13 @@ BOOL is_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *owner) /*------------------------------------------------------------------*/ BOOL get_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *author) { - char str[NAME_LENGTH], preset[NAME_LENGTH]; + char attr[NAME_LENGTH], str[NAME_LENGTH+100], preset[NAME_LENGTH]; int i; /* search attribute which contains full_name of author */ for (i = 0; i < lbs->n_attr; i++) { - sprintf(str, "Preset %s", attr_list[i]); + strlcpy(attr, attr_list[i], sizeof(attr)); + sprintf(str, "Preset %s", attr); if (getcfg(lbs->name, str, preset, sizeof(preset))) { if (stristr(preset, "$long_name")) { strcpy(author, attrib[i]); @@ -9117,7 +9120,8 @@ BOOL get_author(LOGBOOK *lbs, char attrib[MAX_N_ATTR][NAME_LENGTH], char *author /* if not found, search attribute which contains short_name of author */ for (i = 0; i < lbs->n_attr; i++) { - sprintf(str, "Preset %s", attr_list[i]); + strlcpy(attr, attr_list[i], sizeof(attr)); + sprintf(str, "Preset %s", attr); if (getcfg(lbs->name, str, preset, sizeof(preset))) { if (stristr(preset, "$short_name")) { strcpy(author, attrib[i]); @@ -9542,16 +9546,16 @@ void show_edit_form(LOGBOOK *lbs, int message_id, BOOL breply, BOOL bedit, BOOL format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, n_lines, attr_index[MAX_N_ATTR], enc_selected, show_text, n_moptions, display_inline, allowed_encoding, thumb_status, max_n_lines, fixed_text, autosave, new_entry, status; - char str[2 * NAME_LENGTH], str2[NAME_LENGTH], preset[2 * NAME_LENGTH], *p, *pend, star[80], - comment[10000], reply_string[256], list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, + char str[4000], str2[NAME_LENGTH], preset[2 * NAME_LENGTH], *p, *pend, star[80], + comment[1000], reply_string[256], list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80], script_onload[256], script_onfocus[256], script_onunload[256], attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80], reply_tag[MAX_REPLY_TO * 10], att[MAX_ATTACHMENTS][256], encoding[80], slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80], - ua[NAME_LENGTH], mid[80], title[256], login_name[256], full_name[256], - orig_author[256], attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[256], file_enc[256], tooltip[10000], - enc_attr[NAME_LENGTH], user_email[256], cmd[256], thumb_name[256], thumb_ref[256], **user_list, fid[20], - upwd[80], subdir[256], draft[256], page_title[300]; + ua[NAME_LENGTH], mid[80], title[10100], login_name[256], full_name[256], + orig_author[256], attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[4400], file_enc[256], tooltip[1100], + enc_attr[NAME_LENGTH], user_email[256], cmd[1000], thumb_name[256], thumb_ref[256], **user_list, fid[20], + upwd[80], subdir[256], draft[256], page_title[300], attr[NAME_LENGTH]; time_t now, ltime; char fl[8][NAME_LENGTH]; struct tm *pts; @@ -10608,7 +10612,8 @@ void show_edit_form(LOGBOOK *lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* retrieve attribute flags */ for (i = 0; i < n_attr; i++) { format_flags[i] = 0; - sprintf(str, "Format %s", attr_list[i]); + strlcpy(attr, attr_list[i], sizeof(attr)); + sprintf(str, "Format %s", attr); if (getcfg(lbs->name, str, format, sizeof(format))) { n = strbreak(format, fl, 8, ",", FALSE); if (n > 0) @@ -11898,16 +11903,18 @@ void show_edit_form(LOGBOOK *lbs, int message_id, BOOL breply, BOOL bedit, BOOL strsubst(thumb_name, sizeof(thumb_name), "-0.png", ""); rsprintf("
\n");
- sprintf(str, "im('att'+'%d','%s','%s','smaller');", index, thumb_name, att[index]);
+ char atti[256];
+ strlcpy(atti, att[index], sizeof(atti));
+ sprintf(str, "im('att'+'%d','%s','%s','smaller');", index, thumb_name, atti);
ricon("smaller", loc("Make smaller"), str);
- sprintf(str, "im('att'+'%d','%s','%s','original');", index, thumb_name, att[index]);
+ sprintf(str, "im('att'+'%d','%s','%s','original');", index, thumb_name, atti);
ricon("original", loc("Original size"), str);
- sprintf(str, "im('att'+'%d','%s','%s','larger');", index, thumb_name, att[index]);
+ sprintf(str, "im('att'+'%d','%s','%s','larger');", index, thumb_name, atti);
ricon("larger", loc("Make larger"), str);
rsprintf(" \n");
- sprintf(str, "im('att'+'%d','%s','%s','rotleft');", index, thumb_name, att[index]);
+ sprintf(str, "im('att'+'%d','%s','%s','rotleft');", index, thumb_name, atti);
ricon("rotleft", loc("Rotate left"), str);
- sprintf(str, "im('att'+'%d','%s','%s','rotright');", index, thumb_name, att[index]);
+ sprintf(str, "im('att'+'%d','%s','%s','rotright');", index, thumb_name, atti);
ricon("rotright", loc("Rotate right"), str);
rsprintf(" \n");
sprintf(str, "deleteAtt('%d','%s')", index,
@@ -12123,9 +12130,9 @@ void show_edit_form(LOGBOOK *lbs, int message_id, BOOL breply, BOOL bedit, BOOL
void show_find_form(LOGBOOK *lbs) {
int i, j, year, month, day, flag;
- char str[NAME_LENGTH], mode[NAME_LENGTH], comment[NAME_LENGTH], option[NAME_LENGTH], login_name[256],
- full_name[256], user_email[256], enc_attr[NAME_LENGTH], whole_attr[NAME_LENGTH],
- attrib[MAX_N_ATTR][NAME_LENGTH];
+ char str[NAME_LENGTH+100], mode[NAME_LENGTH], comment[NAME_LENGTH], option[NAME_LENGTH], login_name[256],
+ full_name[256], user_email[256], enc_attr[NAME_LENGTH], whole_attr[2000],
+ attrib[MAX_N_ATTR][NAME_LENGTH], attr[NAME_LENGTH];
/*---- header ----*/
@@ -12397,7 +12404,8 @@ void show_find_form(LOGBOOK *lbs) {
break;
get_user_line(lbs, login_name, NULL, full_name, NULL, NULL, NULL, NULL);
- sprintf(str, "%s_%d", attr_list[i], j);
+ strlcpy(attr, attr_list[i], sizeof(attr));
+ sprintf(str, "%s_%d", attr, j);
rsprintf(" ", loc("down"),
loc("down"));
- sprintf(str, "Tooltip %s", disp_attr[i]);
+ strlcpy(attr, disp_attr[i], sizeof(attr));
+ sprintf(str, "Tooltip %s", attr);
if (getcfg(lbs->name, str, comment, sizeof(comment)))
sprintf(str, "title=\"%s\"", comment);
else
@@ -22928,7 +22947,7 @@ void submit_elog(LOGBOOK *lbs) {
subst_str[MAX_PATH_LENGTH], in_reply_to[80], reply_to[MAX_REPLY_TO * 10], user[256],
user_email[256], mail_param[1000], *mail_to, *rcpt_to, full_name[256],
att_file[MAX_ATTACHMENTS][256], slist[MAX_N_ATTR + 10][NAME_LENGTH],
- svalue[MAX_N_ATTR + 10][NAME_LENGTH], ua[NAME_LENGTH], draft[256];
+ svalue[MAX_N_ATTR + 10][NAME_LENGTH], ua[NAME_LENGTH], draft[256], attr[NAME_LENGTH];
int i, j, k, n, missing, first, index, mindex, suppress, message_id, resubmit_orig, mail_to_size,
rcpt_to_size, ltime, year, month, day, hour, min, sec, n_attr, email_notify[1000], allowed_encoding,
status, bdraft, old_mail;
@@ -23284,7 +23303,8 @@ void submit_elog(LOGBOOK *lbs) {
/* substitute attributes */
if (!bedit && !isparam("reply_to")) {
for (index = 0; index < n_attr; index++) {
- sprintf(str, "Subst %s", attr_list[index]);
+ strlcpy(attr, attr_list[index], sizeof(attr));
+ sprintf(str, "Subst %s", attr);
if (getcfg(lbs->name, str, subst_str, sizeof(subst_str))) {
/* do not format date for date attributes */
|