From: Richard Russon Date: Sat, 23 Feb 2019 12:31:54 +0000 (+0000) Subject: replace LONG_STRING with 1024 X-Git-Tag: 2019-10-25~348^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1781ee52e424edd04ec9ceaba50dacb14b30502;p=neomutt replace LONG_STRING with 1024 --- diff --git a/addrbook.c b/addrbook.c index 811c54bb1..ae8ca0f19 100644 --- a/addrbook.c +++ b/addrbook.c @@ -193,7 +193,7 @@ void mutt_alias_menu(char *buf, size_t buflen, struct AliasList *aliases) int t = -1; int i; bool done = false; - char helpstr[LONG_STRING]; + char helpstr[1024]; int omax; diff --git a/alias.c b/alias.c index 6bdb11417..986cc45f6 100644 --- a/alias.c +++ b/alias.c @@ -258,7 +258,7 @@ static int check_alias_name(const char *s, char *dest, size_t destlen) */ static bool string_is_address(const char *str, const char *u, const char *d) { - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), "%s@%s", NONULL(u), NONULL(d)); if (mutt_str_strcasecmp(str, buf) == 0) @@ -368,9 +368,9 @@ struct Address *mutt_get_address(struct Envelope *env, const char **pfxp) void mutt_alias_create(struct Envelope *cur, struct Address *iaddr) { struct Alias *new = NULL; - char buf[LONG_STRING], tmp[LONG_STRING], prompt[128], *pc = NULL; + char buf[1024], tmp[1024], prompt[128], *pc = NULL; char *err = NULL; - char fixed[LONG_STRING]; + char fixed[1024]; FILE *rc = NULL; struct Address *addr = NULL; diff --git a/browser.c b/browser.c index f4fbdd965..1ecab21f4 100644 --- a/browser.c +++ b/browser.c @@ -1090,7 +1090,7 @@ void mutt_select_file(char *file, size_t filelen, int flags, char ***files, int { char buf[PATH_MAX]; char prefix[PATH_MAX] = ""; - char helpstr[LONG_STRING]; + char helpstr[1024]; char title[256]; struct BrowserState state = { 0 }; struct Menu *menu = NULL; diff --git a/color.c b/color.c index abaf8ed47..ae69be616 100644 --- a/color.c +++ b/color.c @@ -768,7 +768,7 @@ static enum CommandResult add_pattern(struct ColorLineHead *top, const char *s, tmp = new_color_line(); if (is_index) { - char buf[LONG_STRING]; + char buf[1024]; mutt_str_strfcpy(buf, s, sizeof(buf)); mutt_check_simple(buf, sizeof(buf), NONULL(C_SimpleSearch)); tmp->color_pattern = mutt_pattern_comp(buf, MUTT_FULL_MSG, err); diff --git a/commands.c b/commands.c index ddfde915c..70ecc3b86 100644 --- a/commands.c +++ b/commands.c @@ -174,7 +174,7 @@ static void update_protected_headers(struct Email *cur) */ int mutt_display_message(struct Email *cur) { - char tempfile[PATH_MAX], buf[LONG_STRING]; + char tempfile[PATH_MAX], buf[1024]; int rc = 0; bool builtin = false; int cmflags = MUTT_CM_DECODE | MUTT_CM_DISPLAY | MUTT_CM_CHARCONV; @@ -654,7 +654,7 @@ void mutt_pipe_message(struct Mailbox *m, struct EmailList *el) if (!m || !el) return; - char buffer[LONG_STRING] = { 0 }; + char buffer[1024] = { 0 }; if ((mutt_get_field(_("Pipe to command: "), buffer, sizeof(buffer), MUTT_CMD) != 0) || (buffer[0] == '\0')) @@ -786,7 +786,7 @@ int mutt_select_sort(int reverse) */ void mutt_shell_escape(void) { - char buf[LONG_STRING]; + char buf[1024]; buf[0] = '\0'; if (mutt_get_field(_("Shell command: "), buf, sizeof(buf), MUTT_CMD) != 0) @@ -814,7 +814,7 @@ void mutt_shell_escape(void) */ void mutt_enter_command(void) { - char buffer[LONG_STRING] = { 0 }; + char buffer[1024] = { 0 }; /* if enter is pressed after : with no command, just return */ if (mutt_get_field(":", buffer, sizeof(buffer), MUTT_COMMAND) != 0 || !buffer[0]) @@ -1177,8 +1177,8 @@ int mutt_save_message(struct Mailbox *m, struct EmailList *el, bool delete, */ int mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp) { - char buf[LONG_STRING]; - char obuf[LONG_STRING]; + char buf[1024]; + char obuf[1024]; char tmp[256]; char charset[256]; diff --git a/compose.c b/compose.c index 1390af0c7..3a6a39451 100644 --- a/compose.c +++ b/compose.c @@ -439,7 +439,7 @@ static int check_attachments(struct AttachCtx *actx) */ static void draw_envelope_addr(int line, struct Address *addr) { - char buf[LONG_STRING]; + char buf[1024]; buf[0] = '\0'; mutt_addr_write(buf, sizeof(buf), addr, true); @@ -698,7 +698,7 @@ static void compose_custom_redraw(struct Menu *menu) if (menu->redraw & REDRAW_STATUS) { - char buf[LONG_STRING]; + char buf[1024]; compose_status_line(buf, sizeof(buf), 0, MuttStatusWindow->cols, menu, NONULL(C_ComposeFormat)); mutt_window_move(MuttStatusWindow, 0, 0); @@ -886,7 +886,7 @@ static void compose_status_line(char *buf, size_t buflen, size_t col, int cols, */ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags) { - char helpstr[LONG_STRING]; // This isn't copied by the help bar + char helpstr[1024]; // This isn't copied by the help bar char buf[PATH_MAX]; int op_close = OP_NULL; int rc = -1; diff --git a/conn/connection.h b/conn/connection.h index f450ba2ea..95d62b728 100644 --- a/conn/connection.h +++ b/conn/connection.h @@ -37,7 +37,7 @@ struct Connection struct ConnAccount account; unsigned int ssf; /**< security strength factor, in bits */ - char inbuf[LONG_STRING]; + char inbuf[1024]; int bufpos; int fd; diff --git a/conn/ssl.c b/conn/ssl.c index 5f84e36c4..de3975869 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -889,7 +889,7 @@ static bool interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, bo }; X509_NAME *x509_subject = NULL; X509_NAME *x509_issuer = NULL; - char helpstr[LONG_STRING]; + char helpstr[1024]; char buf[256]; char title[256]; struct Menu *menu = mutt_menu_new(MENU_GENERIC); diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 1f44a8a40..347b91b89 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -459,7 +459,7 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, time_t t; char datestr[30]; struct Menu *menu = NULL; - char helpstr[LONG_STRING]; + char helpstr[1024]; char title[256]; FILE *fp = NULL; gnutls_datum_t pemdata; diff --git a/copy.c b/copy.c index 26fa97801..a9a45779b 100644 --- a/copy.c +++ b/copy.c @@ -75,7 +75,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, bool from = false; bool this_is_from = false; bool ignore = false; - char buf[LONG_STRING]; /* should be long enough to get most fields in one pass */ + char buf[1024]; /* should be long enough to get most fields in one pass */ char *nl = NULL; char **headers = NULL; int hdr_count; @@ -470,7 +470,7 @@ int mutt_copy_header(FILE *in, struct Email *e, FILE *out, int chflags, const ch char *folder = nm_email_get_folder(e); if (folder && !(C_Weed && mutt_matches_ignore("folder"))) { - char buf[LONG_STRING]; + char buf[1024]; mutt_str_strfcpy(buf, folder, sizeof(buf)); mutt_pretty_mailbox(buf, sizeof(buf)); diff --git a/edit.c b/edit.c index 42c0eba7c..8b3c73a49 100644 --- a/edit.c +++ b/edit.c @@ -135,7 +135,7 @@ static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen, */ static char **be_snarf_file(const char *path, char **buf, int *max, int *len, bool verbose) { - char tmp[LONG_STRING]; + char tmp[1024]; struct stat sb; FILE *f = fopen(path, "r"); @@ -210,7 +210,7 @@ static char **be_include_messages(char *msg, char **buf, int *bufmax, { int n; // int offset, bytes; - char tmp[LONG_STRING]; + char tmp[1024]; if (!msg || !buf || !bufmax || !buflen) return buf; @@ -400,7 +400,7 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) { char **buf = NULL; int bufmax = 0, buflen = 0; - char tmp[LONG_STRING]; + char tmp[1024]; bool abort = false; bool done = false; char *p = NULL; diff --git a/email/address.c b/email/address.c index 177a0b86c..f49ecbb71 100644 --- a/email/address.c +++ b/email/address.c @@ -296,7 +296,7 @@ static const char *parse_address(const char *s, char *token, size_t *tokenlen, static const char *parse_route_addr(const char *s, char *comment, size_t *commentlen, size_t commentmax, struct Address *addr) { - char token[LONG_STRING]; + char token[1024]; size_t tokenlen = 0; s = mutt_str_skip_email_wsp(s); @@ -352,7 +352,7 @@ static const char *parse_route_addr(const char *s, char *comment, size_t *commen static const char *parse_addr_spec(const char *s, char *comment, size_t *commentlen, size_t commentmax, struct Address *addr) { - char token[LONG_STRING]; + char token[1024]; size_t tokenlen = 0; s = parse_address(s, token, &tokenlen, sizeof(token) - 1, comment, commentlen, @@ -466,7 +466,7 @@ struct Address *mutt_addr_parse_list(struct Address *top, const char *s) { int ws_pending; const char *ps = NULL; - char comment[LONG_STRING], phrase[LONG_STRING]; + char comment[1024], phrase[1024]; size_t phraselen = 0, commentlen = 0; struct Address *cur = NULL; diff --git a/email/parse.c b/email/parse.c index 4e453085a..7a7427dd3 100644 --- a/email/parse.c +++ b/email/parse.c @@ -95,7 +95,7 @@ void mutt_auto_subscribe(const char *mailto) static void parse_parameters(struct ParameterList *param, const char *s) { struct Parameter *new = NULL; - char buffer[LONG_STRING]; + char buffer[1024]; const char *p = NULL; size_t i; @@ -1014,11 +1014,11 @@ char *mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen) struct Envelope *mutt_rfc822_read_header(FILE *f, struct Email *e, bool user_hdrs, bool weed) { struct Envelope *env = mutt_env_new(); - char *line = mutt_mem_malloc(LONG_STRING); char *p = NULL; LOFF_T loc; - size_t linelen = LONG_STRING; - char buf[LONG_STRING + 1]; + size_t linelen = 1024; + char *line = mutt_mem_malloc(linelen); + char buf[linelen + 1]; if (e) { @@ -1045,7 +1045,7 @@ struct Envelope *mutt_rfc822_read_header(FILE *f, struct Email *e, bool user_hdr p = strpbrk(line, ": \t"); if (!p || (*p != ':')) { - char return_path[LONG_STRING]; + char return_path[1024]; time_t t; /* some bogus MTAs will quote the original "From " line */ @@ -1164,8 +1164,8 @@ struct Body *mutt_read_mime_header(FILE *fp, bool digest) struct Body *p = mutt_body_new(); struct Envelope *env = mutt_env_new(); char *c = NULL; - char *line = mutt_mem_malloc(LONG_STRING); - size_t linelen = LONG_STRING; + size_t linelen = 1024; + char *line = mutt_mem_malloc(linelen); p->hdr_offset = ftello(fp); @@ -1325,7 +1325,7 @@ void mutt_parse_part(FILE *fp, struct Body *b) */ struct Body *mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off, bool digest) { - char buffer[LONG_STRING]; + char buffer[1024]; struct Body *head = NULL, *last = NULL, *new = NULL; bool final = false; /* did we see the ending boundary? */ @@ -1336,7 +1336,7 @@ struct Body *mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off } const size_t blen = mutt_str_strlen(boundary); - while ((ftello(fp) < end_off) && fgets(buffer, LONG_STRING, fp)) + while ((ftello(fp) < end_off) && fgets(buffer, sizeof(buffer), fp)) { const size_t len = mutt_str_strlen(buffer); @@ -1379,7 +1379,7 @@ struct Body *mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off if (mutt_str_atoi(mutt_param_get(&new->parameter, "content-lines"), &lines) < 0) lines = 0; for (; lines; lines--) - if ((ftello(fp) >= end_off) || !fgets(buffer, LONG_STRING, fp)) + if ((ftello(fp) >= end_off) || !fgets(buffer, sizeof(buffer), fp)) break; } #endif diff --git a/enriched.c b/enriched.c index c60e174cb..f59289bb5 100644 --- a/enriched.c +++ b/enriched.c @@ -289,7 +289,7 @@ static void enriched_putwc(wchar_t c, struct EnrichedState *stte) /* see if more space is needed (plus extra for possible rich characters) */ if (stte->buf_len < (stte->buf_used + 3)) { - stte->buf_len += LONG_STRING; + stte->buf_len += 1024; mutt_mem_realloc(&stte->buffer, (stte->buf_len + 1) * sizeof(wchar_t)); } @@ -352,7 +352,7 @@ static void enriched_puts(const char *s, struct EnrichedState *stte) if (stte->buf_len < (stte->buf_used + mutt_str_strlen(s))) { - stte->buf_len += LONG_STRING; + stte->buf_len += 1024; mutt_mem_realloc(&stte->buffer, (stte->buf_len + 1) * sizeof(wchar_t)); } c = s; @@ -474,7 +474,7 @@ int text_enriched_handler(struct Body *a, struct State *s) struct EnrichedState stte = { 0 }; wchar_t wc = 0; int tag_len = 0; - wchar_t tag[LONG_STRING + 1]; + wchar_t tag[1024 + 1]; stte.s = s; stte.wrap_margin = @@ -551,7 +551,7 @@ int text_enriched_handler(struct Body *a, struct State *s) enriched_set_flags(tag, &stte); state = TEXT; } - else if (tag_len < LONG_STRING) /* ignore overly long tags */ + else if (tag_len < 1024) /* ignore overly long tags */ tag[tag_len++] = wc; else state = BOGUS_TAG; diff --git a/handler.c b/handler.c index 633ea92ec..a722d2a0c 100644 --- a/handler.c +++ b/handler.c @@ -432,7 +432,7 @@ static void decode_uuencoded(struct State *s, long len, bool istext, iconv_t cd) static bool is_mmnoask(const char *buf) { char *p = NULL; - char tmp[LONG_STRING], *q = NULL; + char tmp[1024], *q = NULL; const char *val = mutt_str_getenv("MM_NOASK"); if (!val) @@ -527,7 +527,7 @@ static bool is_autoview(struct Body *b) static int autoview_handler(struct Body *a, struct State *s) { struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); - char buffer[LONG_STRING]; + char buffer[1024]; char type[256]; char command[HUGE_STRING]; char tempfile[PATH_MAX] = ""; @@ -745,7 +745,7 @@ static int message_handler(struct Body *a, struct State *s) static int external_body_handler(struct Body *b, struct State *s) { const char *str = NULL; - char strbuf[LONG_STRING]; + char strbuf[1024]; const char *access_type = mutt_param_get(&b->parameter, "access-type"); if (!access_type) diff --git a/hdrline.c b/hdrline.c index 1c16464cb..74cafc331 100644 --- a/hdrline.c +++ b/hdrline.c @@ -549,7 +549,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co unsigned long data, int flags) { struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data; - char fmt[128], tmp[LONG_STRING], *p, *tags = NULL; + char fmt[128], tmp[1024], *p, *tags = NULL; const char *wch = NULL; int i; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/help.c b/help.c index 35adeb7fb..bd846dbf5 100644 --- a/help.c +++ b/help.c @@ -294,7 +294,7 @@ static void format_line(FILE *f, int ismacro, const char *t1, const char *t2, co if (split) { col = 0; - col_b = LONG_STRING; + col_b = 1024; fputc('\n', f); } else @@ -327,7 +327,7 @@ static void format_line(FILE *f, int ismacro, const char *t1, const char *t2, co if (split) { - print_macro(f, LONG_STRING, &t3); + print_macro(f, 1024, &t3); fputc('\n', f); } else diff --git a/imap/auth_cram.c b/imap/auth_cram.c index 20384dfb0..15528a4b0 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -97,7 +97,7 @@ static void hmac_md5(const char *password, char *challenge, unsigned char *respo */ enum ImapAuthRes imap_auth_cram_md5(struct ImapAccountData *adata, const char *method) { - char ibuf[LONG_STRING * 2], obuf[LONG_STRING]; + char ibuf[2048], obuf[1024]; unsigned char hmac_response[MD5_DIGEST_LEN]; int len; int rc; diff --git a/imap/auth_login.c b/imap/auth_login.c index 141a1a4e8..10c212ac2 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -45,7 +45,7 @@ enum ImapAuthRes imap_auth_login(struct ImapAccountData *adata, const char *method) { char q_user[256], q_pass[256]; - char buf[LONG_STRING]; + char buf[1024]; if ((adata->capabilities & IMAP_CAP_LOGINDISABLED)) { diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 7fa285b64..39462b8db 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -127,7 +127,7 @@ enum ImapAuthRes imap_auth_sasl(struct ImapAccountData *adata, const char *metho mutt_message(_("Authenticating (%s)..."), mech); - bufsize = ((olen * 2) > LONG_STRING) ? (olen * 2) : LONG_STRING; + bufsize = MAX((olen * 2), 1024); buf = mutt_mem_malloc(bufsize); snprintf(buf, bufsize, "AUTHENTICATE %s", mech); diff --git a/imap/browse.c b/imap/browse.c index 78bfd7a1e..4e64a6317 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -66,7 +66,7 @@ static void add_folder(char delim, char *folder, bool noselect, bool noinferiors char tmp[PATH_MAX]; char relpath[PATH_MAX]; struct ConnAccount conn_account; - char mailbox[LONG_STRING]; + char mailbox[1024]; if (imap_parse_path(state->folder, &conn_account, mailbox, sizeof(mailbox))) return; @@ -366,7 +366,7 @@ int imap_mailbox_create(const char *path) { struct ImapAccountData *adata = NULL; struct ImapMboxData *mdata = NULL; - char name[LONG_STRING]; + char name[1024]; short n; if (imap_adata_find(path, &adata, &mdata) < 0) diff --git a/imap/imap.c b/imap/imap.c index 8b9db915d..2bc2f0008 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -304,7 +304,7 @@ static int sync_helper(struct Mailbox *m, int right, int flag, const char *name) { int count = 0; int rc; - char buf[LONG_STRING]; + char buf[1024]; if (!m) return -1; @@ -534,7 +534,7 @@ static int complete_hosts(char *buf, size_t buflen) TAILQ_FOREACH(conn, mutt_socket_head(), entries) { struct Url url; - char urlstr[LONG_STRING]; + char urlstr[1024]; if (conn->account.type != MUTT_ACCT_TYPE_IMAP) continue; @@ -569,7 +569,7 @@ static int complete_hosts(char *buf, size_t buflen) */ int imap_create_mailbox(struct ImapAccountData *adata, char *mailbox) { - char buf[LONG_STRING * 2], mbox[LONG_STRING]; + char buf[2048], mbox[1024]; imap_munge_mbox_name(adata->unicode, mbox, sizeof(mbox), mailbox); snprintf(buf, sizeof(buf), "CREATE %s", mbox); @@ -611,8 +611,8 @@ int imap_access(const char *path) */ int imap_rename_mailbox(struct ImapAccountData *adata, char *oldname, const char *newname) { - char oldmbox[LONG_STRING]; - char newmbox[LONG_STRING]; + char oldmbox[1024]; + char newmbox[1024]; int rc = 0; imap_munge_mbox_name(adata->unicode, oldmbox, sizeof(oldmbox), oldname); @@ -847,7 +847,7 @@ void imap_expunge_mailbox(struct Mailbox *m) */ int imap_open_connection(struct ImapAccountData *adata) { - char buf[LONG_STRING]; + char buf[1024]; if (mutt_socket_open(adata->conn) < 0) return -1; @@ -1092,7 +1092,7 @@ int imap_sync_message_for_copy(struct Mailbox *m, struct Email *e, if (!adata || adata->mailbox != m) return -1; - char flags[LONG_STRING]; + char flags[1024]; char *tags = NULL; char uid[11]; @@ -1262,7 +1262,7 @@ int imap_check_mailbox(struct Mailbox *m, bool force) static int imap_status(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool queue) { char *uid_validity_flag; - char command[LONG_STRING * 2]; + char command[2048]; if (!adata || !mdata) return -1; @@ -1395,8 +1395,8 @@ int imap_subscribe(char *path, bool subscribe) { struct ImapAccountData *adata = NULL; struct ImapMboxData *mdata = NULL; - char buf[LONG_STRING * 2]; - char mbox[LONG_STRING]; + char buf[2048]; + char mbox[1024]; char errstr[256]; struct Buffer err, token; size_t len = 0; @@ -1453,9 +1453,9 @@ int imap_complete(char *buf, size_t buflen, char *path) { struct ImapAccountData *adata = NULL; struct ImapMboxData *mdata = NULL; - char tmp[LONG_STRING * 2]; + char tmp[2048]; struct ImapList listresp; - char completion[LONG_STRING]; + char completion[1024]; int clen; size_t matchlen = 0; int completions = 0; @@ -1529,7 +1529,7 @@ int imap_complete(char *buf, size_t buflen, char *path) */ int imap_fast_trash(struct Mailbox *m, char *dest) { - char prompt[LONG_STRING]; + char prompt[1024]; int rc = -1; bool triedcreate = false; struct Buffer *sync_cmd = NULL; @@ -1886,7 +1886,7 @@ int imap_ac_add(struct Account *a, struct Mailbox *m) struct ImapMboxData *mdata = imap_mdata_new(adata, url->path); /* fixup path and realpath, mainly to replace / by /INBOX */ - char buf[LONG_STRING]; + char buf[1024]; imap_qualify_path(buf, sizeof(buf), &adata->conn_account, mdata->name); mutt_str_strfcpy(m->path, buf, sizeof(m->path)); mutt_str_strfcpy(m->realpath, m->path, sizeof(m->realpath)); diff --git a/imap/message.c b/imap/message.c index 0358a625c..d51477c6b 100644 --- a/imap/message.c +++ b/imap/message.c @@ -708,7 +708,7 @@ static int read_headers_normal_eval_cache(struct ImapAccountData *adata, bool store_flag_updates, bool eval_condstore) { struct Progress progress; - char buf[LONG_STRING]; + char buf[1024]; struct Mailbox *m = adata->mailbox; struct ImapMboxData *mdata = imap_mdata_get(m); @@ -919,7 +919,7 @@ static int read_headers_condstore_qresync_updates(struct ImapAccountData *adata, unsigned long long hc_modseq, bool eval_qresync) { struct Progress progress; - char buf[LONG_STRING]; + char buf[1024]; unsigned int header_msn = 0; struct Mailbox *m = adata->mailbox; @@ -1417,7 +1417,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) return -1; FILE *fp = NULL; - char buf[LONG_STRING * 2]; + char buf[1024 * 2]; char internaldate[IMAP_DATELEN]; char imap_flags[128]; size_t len; @@ -1835,7 +1835,7 @@ int imap_msg_open(struct Mailbox *m, struct Message *msg, int msgno) return -1; struct Envelope *newenv = NULL; - char buf[LONG_STRING]; + char buf[1024]; char *pc = NULL; unsigned int bytes; struct Progress progressbar; diff --git a/imap/util.c b/imap/util.c index 0b0772c25..95d2472ea 100644 --- a/imap/util.c +++ b/imap/util.c @@ -137,7 +137,7 @@ int imap_adata_find(const char *path, struct ImapAccountData **adata, { struct ConnAccount conn_account; struct ImapAccountData *tmp_adata; - char tmp[LONG_STRING]; + char tmp[1024]; if (imap_parse_path(path, &conn_account, tmp, sizeof(tmp)) < 0) return -1; @@ -166,7 +166,7 @@ int imap_adata_find(const char *path, struct ImapAccountData **adata, */ struct ImapMboxData *imap_mdata_new(struct ImapAccountData *adata, const char *name) { - char buf[LONG_STRING]; + char buf[1024]; struct ImapMboxData *mdata = mutt_mem_calloc(1, sizeof(struct ImapMboxData)); mdata->real_name = mutt_str_strdup(name); @@ -307,7 +307,7 @@ void imap_get_parent_path(const char *path, char *buf, size_t buflen) { struct ImapAccountData *adata = NULL; struct ImapMboxData *mdata = NULL; - char mbox[LONG_STRING]; + char mbox[1024]; if (imap_adata_find(path, &adata, &mdata) < 0) { @@ -700,8 +700,8 @@ void imap_pretty_mailbox(char *path, const char *folder) int tlen; int hlen = 0; bool home_match = false; - char target_mailbox[LONG_STRING]; - char home_mailbox[LONG_STRING]; + char target_mailbox[1024]; + char home_mailbox[1024]; if (imap_parse_path(path, &target_conn_account, target_mailbox, sizeof(target_mailbox)) < 0) return; diff --git a/index.c b/index.c index 783249b2d..62a25a6bf 100644 --- a/index.c +++ b/index.c @@ -983,7 +983,7 @@ static void index_custom_redraw(struct Menu *menu) if (menu->redraw & REDRAW_STATUS) { - char buf[LONG_STRING]; + char buf[1024]; menu_status_line(buf, sizeof(buf), menu, NONULL(C_StatusFormat)); mutt_window_move(MuttStatusWindow, 0, 0); SETCOLOR(MT_COLOR_STATUS); @@ -1011,7 +1011,7 @@ static void index_custom_redraw(struct Menu *menu) */ int mutt_index_menu(void) { - char buf[PATH_MAX], helpstr[LONG_STRING]; + char buf[PATH_MAX], helpstr[1024]; int flags; int op = OP_NULL; bool done = false; /* controls when to exit the "event" loop */ @@ -1125,7 +1125,7 @@ int mutt_index_menu(void) beep(); if (C_NewMailCommand) { - char cmd[LONG_STRING]; + char cmd[1024]; menu_status_line(cmd, sizeof(cmd), menu, NONULL(C_NewMailCommand)); if (mutt_system(cmd) != 0) mutt_error(_("Error running \"%s\""), cmd); @@ -1168,7 +1168,7 @@ int mutt_index_menu(void) beep(); if (C_NewMailCommand) { - char cmd[LONG_STRING]; + char cmd[1024]; menu_status_line(cmd, sizeof(cmd), menu, NONULL(C_NewMailCommand)); if (mutt_system(cmd) != 0) mutt_error(_("Error running \"%s\""), cmd); @@ -1641,7 +1641,7 @@ int mutt_index_menu(void) -1; if (op == OP_TOGGLE_READ) { - char buf2[LONG_STRING]; + char buf2[1024]; if (!Context->pattern || (strncmp(Context->pattern, "!~R!~D~s", 8) != 0)) { diff --git a/init.c b/init.c index 073cc9b6f..80a2b9efa 100644 --- a/init.c +++ b/init.c @@ -81,9 +81,9 @@ static struct ListHead MuttrcStack = STAILQ_HEAD_INITIALIZER(MuttrcStack); #define NUMVARS mutt_array_size(MuttVars) #define NUMCOMMANDS mutt_array_size(Commands) -/* initial string that starts completion. No telling how much crap - * the user has typed so far. Allocate LONG_STRING just to be sure! */ -static char UserTyped[LONG_STRING] = { 0 }; +/* Initial string that starts completion. No telling how much the user has + * typed so far. Allocate 1024 just to be sure! */ +static char UserTyped[1024] = { 0 }; static int NumMatched = 0; /* Number of matches for completion */ static char Completed[256] = { 0 }; /* completed string (command or variable) */ @@ -428,7 +428,7 @@ static bool get_hostname(void) C_Hostname = getmailname(); if (!C_Hostname) { - char buffer[LONG_STRING]; + char buffer[1024]; if (getdnsdomainname(buffer, sizeof(buffer)) == 0) { C_Hostname = mutt_mem_malloc(mutt_str_strlen(buffer) + @@ -3018,7 +3018,7 @@ int mutt_get_hook_type(const char *name) */ int mutt_init(bool skip_sys_rc, struct ListHead *commands) { - char buffer[LONG_STRING]; + char buffer[1024]; int need_pause = 0; struct Buffer err; diff --git a/maildir/maildir.c b/maildir/maildir.c index 71469d5a3..cfe5c1b3d 100644 --- a/maildir/maildir.c +++ b/maildir/maildir.c @@ -194,7 +194,7 @@ void maildir_gen_flags(char *dest, size_t destlen, struct Email *e) if (e && (e->flagged || e->replied || e->read || e->deleted || e->old || e->maildir_flags)) { - char tmp[LONG_STRING]; + char tmp[1024]; snprintf(tmp, sizeof(tmp), "%s%s%s%s%s", e->flagged ? "F" : "", e->replied ? "R" : "", e->read ? "S" : "", e->deleted ? "T" : "", NONULL(e->maildir_flags)); if (e->maildir_flags) diff --git a/main.c b/main.c index 41d159bec..af58f58be 100644 --- a/main.c +++ b/main.c @@ -921,7 +921,7 @@ int main(int argc, char *argv[], char *envp[]) */ if (!edit_infile) { - char buf[LONG_STRING]; + char buf[1024]; mutt_mktemp(buf, sizeof(buf)); tempfile = mutt_str_strdup(buf); diff --git a/mbox/mbox.c b/mbox/mbox.c index 3f7d3fd2e..c8a2d637b 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -189,7 +189,7 @@ static int mmdf_parse_mailbox(struct Mailbox *m) return -1; char buf[HUGE_STRING]; - char return_path[LONG_STRING]; + char return_path[1024]; int count = 0; int lines; time_t t; @@ -1054,7 +1054,7 @@ static int mbox_mbox_check(struct Mailbox *m, int *index_hint) * see the message separator at *exactly* what used to be the end of the * folder. */ - char buffer[LONG_STRING]; + char buffer[1024]; if (fseeko(adata->fp, m->size, SEEK_SET) != 0) mutt_debug(LL_DEBUG1, "#1 fseek() failed\n"); if (fgets(buffer, sizeof(buffer), adata->fp)) diff --git a/menu.c b/menu.c index e4db592df..0e5677418 100644 --- a/menu.c +++ b/menu.c @@ -415,7 +415,7 @@ void menu_redraw_sidebar(struct Menu *menu) */ void menu_redraw_index(struct Menu *menu) { - char buf[LONG_STRING]; + char buf[1024]; bool do_color; int attr; @@ -465,7 +465,7 @@ void menu_redraw_index(struct Menu *menu) */ void menu_redraw_motion(struct Menu *menu) { - char buf[LONG_STRING]; + char buf[1024]; if (menu->dialog) { @@ -523,7 +523,7 @@ void menu_redraw_motion(struct Menu *menu) */ void menu_redraw_current(struct Menu *menu) { - char buf[LONG_STRING]; + char buf[1024]; int attr = menu->menu_color(menu->current); mutt_window_move(menu->indexwin, menu->current + menu->offset - menu->top, 0); @@ -952,7 +952,7 @@ static int default_color(int line) */ static int generic_search(struct Menu *menu, regex_t *rx, int line) { - char buf[LONG_STRING]; + char buf[1024]; menu_make_entry(buf, sizeof(buf), menu, line); return regexec(rx, buf, 0, NULL, 0); diff --git a/mutt/base64.c b/mutt/base64.c index 25801c8f7..c1d01d481 100644 --- a/mutt/base64.c +++ b/mutt/base64.c @@ -34,6 +34,7 @@ #include "config.h" #include "base64.h" #include "buffer.h" +#include "memory.h" #include "string2.h" #define BAD -1 @@ -183,7 +184,7 @@ int mutt_b64_decode(const char *in, char *out, size_t olen) */ size_t mutt_b64_buffer_encode(struct Buffer *buf, const char *in, size_t len) { - mutt_buffer_increase_size(buf, ((len * 2) > LONG_STRING) ? (len * 2) : LONG_STRING); + mutt_buffer_increase_size(buf, MAX((len * 2), 1024)); size_t num = mutt_b64_encode(in, len, buf->data, buf->dsize); mutt_buffer_fix_dptr(buf); return num; diff --git a/mutt/buffer.c b/mutt/buffer.c index 79f28d7af..e62da201d 100644 --- a/mutt/buffer.c +++ b/mutt/buffer.c @@ -351,7 +351,7 @@ static void increase_buffer_pool(void) mutt_mem_realloc(&BufferPool, BufferPoolLen * sizeof(struct Buffer *)); while (BufferPoolCount < 5) { - newbuf = mutt_buffer_alloc(LONG_STRING); + newbuf = mutt_buffer_alloc(1024); BufferPool[BufferPoolCount++] = newbuf; } } @@ -406,9 +406,9 @@ void mutt_buffer_pool_release(struct Buffer **pbuf) } struct Buffer *buf = *pbuf; - if (buf->dsize > (LONG_STRING * 2)) + if (buf->dsize > 2048) { - buf->dsize = LONG_STRING; + buf->dsize = 1024; mutt_mem_realloc(&buf->data, buf->dsize); } mutt_buffer_reset(buf); diff --git a/mutt/charset.c b/mutt/charset.c index f25f647ea..fb3e6e3b6 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -313,7 +313,7 @@ int mutt_ch_convert_nonmime_string(char **ps) */ void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name) { - char in[LONG_STRING], scratch[LONG_STRING]; + char in[1024], scratch[1024]; mutt_str_strfcpy(in, name, sizeof(in)); char *ext = strchr(in, '/'); @@ -422,7 +422,7 @@ char *mutt_ch_get_default_charset(void) */ char *mutt_ch_get_langinfo_charset(void) { - char buf[LONG_STRING] = ""; + char buf[1024] = ""; mutt_ch_canonical_charset(buf, sizeof(buf), nl_langinfo(CODESET)); @@ -1046,7 +1046,7 @@ char *mutt_ch_choose(const char *fromcode, const char *charsets, const char *u, if (dlen) *dlen = elen; - char canonical_buf[LONG_STRING]; + char canonical_buf[1024]; mutt_ch_canonical_charset(canonical_buf, sizeof(canonical_buf), tocode); mutt_str_replace(&tocode, canonical_buf); } diff --git a/mutt/envlist.c b/mutt/envlist.c index e6ffff9d2..88b3a40dd 100644 --- a/mutt/envlist.c +++ b/mutt/envlist.c @@ -84,7 +84,7 @@ void mutt_envlist_init(char *envp[]) bool mutt_envlist_set(const char *name, const char *value, bool overwrite) { char **envp = EnvList; - char work[LONG_STRING]; + char work[1024]; int count; /* Look for current slot to overwrite */ diff --git a/mutt/file.c b/mutt/file.c index 594128720..010aaaa9a 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -263,7 +263,7 @@ int mutt_file_copy_bytes(FILE *in, FILE *out, size_t size) int mutt_file_copy_stream(FILE *fin, FILE *fout) { size_t l; - char buf[LONG_STRING]; + char buf[1024]; while ((l = fread(buf, 1, sizeof(buf), fin)) > 0) { diff --git a/mutt/logging.c b/mutt/logging.c index f8c4ecb41..b93ec80d3 100644 --- a/mutt/logging.c +++ b/mutt/logging.c @@ -396,12 +396,12 @@ int log_queue_save(FILE *fp) * * @sa log_queue_set_max_size(), log_queue_flush(), log_queue_empty() * - * @warning Log lines are limited to #LONG_STRING bytes. + * @warning Log lines are limited to 1024 bytes. */ int log_disp_queue(time_t stamp, const char *file, int line, const char *function, int level, ...) { - char buf[LONG_STRING] = ""; + char buf[1024] = ""; int err = errno; va_list ap; @@ -445,7 +445,7 @@ int log_disp_terminal(time_t stamp, const char *file, int line, if ((level < LL_PERROR) || (level > LL_MESSAGE)) return 0; - char buf[LONG_STRING]; + char buf[1024]; va_list ap; va_start(ap, level); diff --git a/mutt/regex.c b/mutt/regex.c index f3630bca8..97db38048 100644 --- a/mutt/regex.c +++ b/mutt/regex.c @@ -342,14 +342,14 @@ int mutt_replacelist_add(struct ReplaceList *rl, const char *pat, * * If 'buf' is NULL, a new string will be returned. It must be freed by the caller. * - * @note This function uses a fixed size buffer of LONG_STRING and so should + * @note This function uses a fixed size buffer of 1024 and so should * only be used for visual modifications, such as disp_subj. */ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, const char *str) { static regmatch_t *pmatch = NULL; static size_t nmatch = 0; - static char twinbuf[2][LONG_STRING]; + static char twinbuf[2][1024]; int switcher = 0; char *p = NULL; size_t cpysize, tlen; @@ -366,7 +366,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c src = twinbuf[switcher]; dst = src; - mutt_str_strfcpy(src, str, LONG_STRING); + mutt_str_strfcpy(src, str, 1024); struct ReplaceListNode *np = NULL; STAILQ_FOREACH(np, rl, entries) @@ -389,7 +389,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c /* Copy into other twinbuf with substitutions */ if (np->template) { - for (p = np->template; *p && (tlen < LONG_STRING - 1);) + for (p = np->template; *p && (tlen < 1023);) { if (*p == '%') { @@ -397,14 +397,14 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c if (*p == 'L') { p++; - cpysize = MIN(pmatch[0].rm_so, LONG_STRING - tlen - 1); + cpysize = MIN(pmatch[0].rm_so, 1023 - tlen); strncpy(&dst[tlen], src, cpysize); tlen += cpysize; } else if (*p == 'R') { p++; - cpysize = MIN(strlen(src) - pmatch[0].rm_eo, LONG_STRING - tlen - 1); + cpysize = MIN(strlen(src) - pmatch[0].rm_eo, 1023 - tlen); strncpy(&dst[tlen], &src[pmatch[0].rm_eo], cpysize); tlen += cpysize; } @@ -414,7 +414,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c while (isdigit((unsigned char) *p)) /* skip subst token */ p++; for (int i = pmatch[n].rm_so; - (i < pmatch[n].rm_eo) && (tlen < LONG_STRING - 1); i++) + (i < pmatch[n].rm_eo) && (tlen < 1023); i++) { dst[tlen++] = src[i]; } diff --git a/mutt/string2.h b/mutt/string2.h index 032732896..adf581f5c 100644 --- a/mutt/string2.h +++ b/mutt/string2.h @@ -31,7 +31,6 @@ #include #include -#define LONG_STRING 1024 #define HUGE_STRING 8192 #define NONULL(x) (x ? x : "") diff --git a/mutt_header.c b/mutt_header.c index 535ef371f..5338d253f 100644 --- a/mutt_header.c +++ b/mutt_header.c @@ -128,7 +128,7 @@ int mutt_label_message(struct Mailbox *m, struct EmailList *el) if (!m || !el) return 0; - char buf[LONG_STRING] = { 0 }; + char buf[1024] = { 0 }; char *new = NULL; struct EmailNode *en = STAILQ_FIRST(el); @@ -172,7 +172,7 @@ void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen) { char path[PATH_MAX]; /* tempfile used to edit headers + body */ - char buffer[LONG_STRING]; + char buffer[1024]; const char *p = NULL; int i; struct Envelope *n = NULL; diff --git a/mutt_history.c b/mutt_history.c index 47fd86820..fa95c9cd5 100644 --- a/mutt_history.c +++ b/mutt_history.c @@ -91,7 +91,7 @@ static void history_make_entry(char *buf, size_t buflen, struct Menu *menu, int static void history_menu(char *buf, size_t buflen, char **matches, int match_count) { int done = 0; - char helpstr[LONG_STRING]; + char helpstr[1024]; char title[256]; snprintf(title, sizeof(title), _("History '%s'"), buf); diff --git a/mutt_logging.c b/mutt_logging.c index a91ba9cb7..c15089317 100644 --- a/mutt_logging.c +++ b/mutt_logging.c @@ -158,7 +158,7 @@ int log_disp_curses(time_t stamp, const char *file, int line, if (level > C_DebugLevel) return 0; - char buf[LONG_STRING]; + char buf[1024]; va_list ap; va_start(ap, level); diff --git a/mutt_lua.c b/mutt_lua.c index 7514ab2e8..894061db3 100644 --- a/mutt_lua.c +++ b/mutt_lua.c @@ -82,7 +82,7 @@ static int lua_mutt_call(lua_State *l) { mutt_debug(LL_DEBUG2, " * lua_mutt_call()\n"); struct Buffer token, expn, err; - char buffer[LONG_STRING] = ""; + char buffer[1024] = ""; const struct Command *command = NULL; int rc = 0; @@ -359,7 +359,7 @@ static int lua_mutt_error(lua_State *l) static void lua_expose_command(void *p, const struct Command *cmd) { lua_State *l = (lua_State *) p; - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), "mutt.command.%s = function (...); mutt.call('%s', ...); end", cmd->name, cmd->name); (void) luaL_dostring(l, buf); diff --git a/mutt_socket.c b/mutt_socket.c index 821a41a52..4d9f71800 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -86,7 +86,7 @@ struct Connection *mutt_conn_find(const struct Connection *start, const struct ConnAccount *account) { struct Url url; - char hook[LONG_STRING]; + char hook[1024]; /* account isn't actually modified, since url isn't either */ mutt_account_tourl((struct ConnAccount *) account, &url); diff --git a/mutt_window.c b/mutt_window.c index 5a7c6ad27..f7539f5a0 100644 --- a/mutt_window.c +++ b/mutt_window.c @@ -53,7 +53,7 @@ struct MuttWindow *MuttSidebarWindow = NULL; /**< Sidebar Window */ */ static int vw_printw(SLcurses_Window_Type *win, const char *fmt, va_list ap) { - char buf[LONG_STRING]; + char buf[1024]; (void) SLvsnprintf(buf, sizeof(buf), (char *) fmt, ap); SLcurses_waddnstr(win, buf, -1); diff --git a/muttlib.c b/muttlib.c index a568d66f0..50630bc46 100644 --- a/muttlib.c +++ b/muttlib.c @@ -817,7 +817,7 @@ void mutt_safe_path(char *buf, size_t buflen, struct Address *a) void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, int flags) { - char prefix[128], tmp[LONG_STRING], *cp = NULL, *wptr = buf, ch; + char prefix[128], tmp[1024], *cp = NULL, *wptr = buf, ch; char if_str[128], else_str[128]; size_t wlen, count, len, wid; FILE *filter = NULL; @@ -850,7 +850,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c /* n-off is the number of backslashes. */ if (off > 0 && ((n - off) % 2) == 0) { - char srccopy[LONG_STRING]; + char srccopy[1024]; int i = 0; mutt_debug(LL_DEBUG3, "fmtpipe = %s\n", src); diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 91ba24c0a..da47222d0 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -1872,7 +1872,7 @@ static int show_one_sig_status(gpgme_ctx_t ctx, int idx, struct State *s) ; /* No state information so no way to print anything. */ else if (err) { - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), _("Error getting key information for KeyID %s: %s\n"), fpr, gpgme_strerror(err)); state_puts(buf, s); @@ -4323,7 +4323,7 @@ static void print_key_info(gpgme_key_t key, FILE *fp) */ static void verify_key(struct CryptKeyInfo *key) { - char cmd[LONG_STRING], tempfile[PATH_MAX]; + char cmd[1024], tempfile[PATH_MAX]; const char *s = NULL; gpgme_ctx_t listctx = NULL; gpgme_error_t err; @@ -4629,7 +4629,7 @@ static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys, int keymax; int i; bool done = false; - char helpstr[LONG_STRING], buf[LONG_STRING]; + char helpstr[1024], buf[1024]; struct CryptKeyInfo *k = NULL; int (*f)(const void *, const void *); enum MenuType menu_to_use = MENU_GENERIC; @@ -4766,7 +4766,7 @@ static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys, !crypt_id_is_strong(key_table[menu->current]))) { const char *warn_s = NULL; - char buf2[LONG_STRING]; + char buf2[1024]; if (key_table[menu->current]->flags & KEYFLAG_CANTUSE) { @@ -5117,7 +5117,7 @@ static char *find_keys(struct Address *addrlist, unsigned int app, bool oppenc_m struct Address *p = NULL, *q = NULL; struct CryptKeyInfo *k_info = NULL; const char *fqdn = mutt_fqdn(true); - char buf[LONG_STRING]; + char buf[1024]; int forced_valid; int r; bool key_selected; @@ -5253,7 +5253,7 @@ struct Body *pgp_gpgme_make_key_attachment(void) gpgme_data_t keydata = NULL; gpgme_error_t err; struct Body *att = NULL; - char buf[LONG_STRING]; + char buf[1024]; struct stat sb; OptPgpCheckTrust = false; diff --git a/ncrypt/gnupgparse.c b/ncrypt/gnupgparse.c index c88fbbf5d..f695fddf0 100644 --- a/ncrypt/gnupgparse.c +++ b/ncrypt/gnupgparse.c @@ -413,7 +413,7 @@ struct PgpKeyInfo *pgp_get_candidates(enum PgpRing keyring, struct ListHead *hin { FILE *fp = NULL; pid_t thepid; - char buf[LONG_STRING]; + char buf[1024]; struct PgpKeyInfo *db = NULL, **kend = NULL, *k = NULL, *kk = NULL, *mainkey = NULL; int is_sub; int devnull; diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index fb384ea61..6d06e1698 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -74,7 +74,7 @@ struct Regex *C_PgpGoodSign; ///< Config: Text indicating a good signature long C_PgpTimeout; ///< Config: Time in seconds to cache a passphrase bool C_PgpUseGpgAgent; ///< Config: Use a PGP agent for caching passwords -char PgpPass[LONG_STRING]; +char PgpPass[1024]; time_t PgpExptime = 0; /* when does the cached passphrase expire? */ /** @@ -999,7 +999,7 @@ static struct Body *pgp_decrypt_part(struct Body *a, struct State *s, if (!a || !s || !fpout || !p) return NULL; - char buf[LONG_STRING]; + char buf[1024]; FILE *pgpin = NULL, *pgpout = NULL, *pgptmp = NULL; struct stat info; struct Body *tattach = NULL; @@ -1293,7 +1293,7 @@ int pgp_class_encrypted_handler(struct Body *a, struct State *s) struct Body *pgp_class_sign_message(struct Body *a) { struct Body *t = NULL; - char buffer[LONG_STRING]; + char buffer[1024]; char sigfile[PATH_MAX], signedfile[PATH_MAX]; FILE *pgpin = NULL, *pgpout = NULL, *pgperr = NULL, *sfp = NULL; bool err = false; @@ -1426,7 +1426,7 @@ char *pgp_class_find_keys(struct Address *addrlist, bool oppenc_mode) struct Address *addr = NULL; struct Address *p = NULL, *q = NULL; struct PgpKeyInfo *k_info = NULL; - char buf[LONG_STRING]; + char buf[1024]; int r; bool key_selected; @@ -1540,7 +1540,7 @@ char *pgp_class_find_keys(struct Address *addrlist, bool oppenc_mode) */ struct Body *pgp_class_encrypt_message(struct Body *a, char *keylist, bool sign) { - char buf[LONG_STRING]; + char buf[1024]; char tempfile[PATH_MAX]; char pgpinfile[PATH_MAX]; FILE *pgpin = NULL, *fptmp = NULL; @@ -1849,7 +1849,7 @@ int pgp_class_send_menu(struct Email *msg) const char *prompt = NULL; const char *letters = NULL; const char *choices = NULL; - char promptbuf[LONG_STRING]; + char promptbuf[1024]; int choice; if (!(WithCrypto & APPLICATION_PGP)) diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index e410ed7fe..4ae05fa30 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -420,7 +420,7 @@ void pgp_class_invoke_import(const char *fname) void pgp_class_invoke_getkeys(struct Address *addr) { char buf[PATH_MAX]; - char tmp[LONG_STRING]; + char tmp[1024]; char cmd[HUGE_STRING]; int devnull; diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 60facdf21..9d38aa560 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -596,8 +596,8 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct Menu *menu = NULL; int i; bool done = false; - char helpstr[LONG_STRING], buf[LONG_STRING], tmpbuf[256]; - char cmd[LONG_STRING], tempfile[PATH_MAX]; + char helpstr[1024], buf[1024], tmpbuf[256]; + char cmd[1024], tempfile[PATH_MAX]; FILE *fp = NULL, *devnull = NULL; pid_t thepid; struct PgpKeyInfo *kp = NULL; @@ -755,7 +755,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, !pgp_id_is_strong(KeyTable[menu->current]))) { const char *str = ""; - char buf2[LONG_STRING]; + char buf2[1024]; if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE) { @@ -872,7 +872,7 @@ struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, en struct Body *pgp_class_make_key_attachment(void) { struct Body *att = NULL; - char buf[LONG_STRING]; + char buf[1024]; char tempf[PATH_MAX], tmp[256]; FILE *tempfp = NULL; FILE *devnull = NULL; diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 038a3ec77..b7375c079 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -225,7 +225,7 @@ static const char *fmt_smime_command(char *buf, size_t buflen, size_t col, int c if (!optional) { char path[PATH_MAX]; - char buf1[LONG_STRING], buf2[LONG_STRING]; + char buf1[1024], buf2[1024]; struct stat sb; mutt_str_strfcpy(path, C_SmimeCaLocation, sizeof(path)); @@ -532,8 +532,8 @@ static struct SmimeKey *smime_select_key(struct SmimeKey *keys, char *query) int table_index = 0; struct SmimeKey *key = NULL; struct SmimeKey *selected_key = NULL; - char helpstr[LONG_STRING]; - char buf[LONG_STRING]; + char helpstr[1024]; + char buf[1024]; char title[256]; struct Menu *menu = NULL; const char *s = ""; @@ -717,7 +717,7 @@ static struct SmimeKey *smime_parse_key(char *buf) static struct SmimeKey *smime_get_candidates(char *search, bool public) { char index_file[PATH_MAX]; - char buf[LONG_STRING]; + char buf[1024]; struct SmimeKey *key = NULL, *results = NULL; struct SmimeKey **results_end = &results; @@ -1057,7 +1057,7 @@ char *smime_class_find_keys(struct Address *addrlist, bool oppenc_mode) key = smime_get_key_by_addr(q->mailbox, KEYFLAG_CANENCRYPT, true, !oppenc_mode); if (!key && !oppenc_mode) { - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), _("Enter keyID for %s: "), q->mailbox); key = smime_ask_for_key(buf, KEYFLAG_CANENCRYPT, true); } @@ -1544,7 +1544,7 @@ static pid_t smime_invoke_sign(FILE **smimein, FILE **smimeout, FILE **smimeerr, */ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist) { - char buf[LONG_STRING], certfile[PATH_MAX]; + char buf[1024], certfile[PATH_MAX]; char tempfile[PATH_MAX]; char smimeinfile[PATH_MAX]; char *cert_end = NULL; @@ -1699,7 +1699,7 @@ static char *openssl_md_to_smime_micalg(char *md) */ struct Body *smime_class_sign_message(struct Body *a) { - char buffer[LONG_STRING]; + char buffer[1024]; char signedfile[PATH_MAX], filetosign[PATH_MAX]; FILE *smimein = NULL, *smimeout = NULL, *smimeerr = NULL, *sfp = NULL; int err = 0; diff --git a/nntp/newsrc.c b/nntp/newsrc.c index bac81b49e..f80766708 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -446,7 +446,7 @@ int nntp_newsrc_update(struct NntpAccountData *adata) if (!adata) return -1; - buflen = 10 * LONG_STRING; + buflen = 10240; buf = mutt_mem_calloc(1, buflen); off = 0; @@ -470,7 +470,7 @@ int nntp_newsrc_update(struct NntpAccountData *adata) /* write entries */ for (unsigned int j = 0; j < mdata->newsrc_len; j++) { - if (off + LONG_STRING > buflen) + if (off + 1024 > buflen) { buflen *= 2; mutt_mem_realloc(&buf, buflen); @@ -572,7 +572,7 @@ int nntp_add_group(char *line, void *data) { struct NntpAccountData *adata = data; struct NntpMboxData *mdata = NULL; - char group[LONG_STRING] = ""; + char group[1024] = ""; char desc[HUGE_STRING] = ""; char mod; anum_t first, last; @@ -653,7 +653,7 @@ int nntp_active_save_cache(struct NntpAccountData *adata) if (!adata->cacheable) return 0; - buflen = 10 * LONG_STRING; + buflen = 10240; buf = mutt_mem_calloc(1, buflen); snprintf(buf, buflen, "%lu\n", (unsigned long) adata->newgroups_time); off = strlen(buf); diff --git a/nntp/nntp.c b/nntp/nntp.c index bf580e807..56a106e98 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -241,8 +241,8 @@ static int nntp_capabilities(struct NntpAccountData *adata) { struct Connection *conn = adata->conn; bool mode_reader = false; - char buf[LONG_STRING]; - char authinfo[LONG_STRING] = ""; + char buf[1024]; + char authinfo[1024] = ""; adata->hasCAPABILITIES = false; adata->hasSTARTTLS = false; @@ -343,7 +343,7 @@ static int nntp_capabilities(struct NntpAccountData *adata) static int nntp_attempt_features(struct NntpAccountData *adata) { struct Connection *conn = adata->conn; - char buf[LONG_STRING]; + char buf[1024]; /* no CAPABILITIES, trying DATE, LISTGROUP, LIST NEWSGROUPS */ if (!adata->hasCAPABILITIES) @@ -418,14 +418,14 @@ static int nntp_attempt_features(struct NntpAccountData *adata) else { int cont = 0; - size_t buflen = 2 * LONG_STRING, off = 0, b = 0; + size_t buflen = 2048, off = 0, b = 0; FREE(&adata->overview_fmt); adata->overview_fmt = mutt_mem_malloc(buflen); while (true) { - if (buflen - off < LONG_STRING) + if (buflen - off < 1024) { buflen *= 2; mutt_mem_realloc(&adata->overview_fmt, buflen); @@ -504,7 +504,7 @@ static bool nntp_memchr(char **haystack, char *sentinel, int needle) */ static void nntp_log_binbuf(const char *buf, size_t len, const char *pfx, int dbg) { - char tmp[LONG_STRING]; + char tmp[1024]; char *p = tmp; char *sentinel = tmp + len; @@ -527,8 +527,8 @@ static void nntp_log_binbuf(const char *buf, size_t len, const char *pfx, int db static int nntp_auth(struct NntpAccountData *adata) { struct Connection *conn = adata->conn; - char buf[LONG_STRING]; - char authenticators[LONG_STRING] = "USER"; + char buf[1024]; + char authenticators[1024] = "USER"; char *method = NULL, *a = NULL, *p = NULL; unsigned char flags = conn->account.flags; @@ -637,7 +637,7 @@ static int nntp_auth(struct NntpAccountData *adata) sasl_conn_t *saslconn = NULL; sasl_interact_t *interaction = NULL; int rc; - char inbuf[LONG_STRING] = ""; + char inbuf[1024] = ""; const char *mech = NULL; const char *client_out = NULL; unsigned int client_len, len; @@ -788,7 +788,7 @@ static int nntp_auth(struct NntpAccountData *adata) static int nntp_query(struct NntpMboxData *mdata, char *line, size_t linelen) { struct NntpAccountData *adata = mdata->adata; - char buf[LONG_STRING] = { 0 }; + char buf[1024] = { 0 }; if (adata->status == NNTP_BYE) return -1; @@ -870,7 +870,7 @@ static int nntp_fetch_lines(struct NntpMboxData *mdata, char *query, size_t qlen while (!done) { - char buf[LONG_STRING]; + char buf[1024]; char *line = NULL; unsigned int lines = 0; size_t off = 0; @@ -1498,7 +1498,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t */ static int nntp_group_poll(struct NntpMboxData *mdata, bool update_stat) { - char buf[LONG_STRING] = ""; + char buf[1024] = ""; anum_t count, first, last; /* use GROUP command to poll newsgroup */ @@ -1759,7 +1759,7 @@ static int nntp_date(struct NntpAccountData *adata, time_t *now) if (adata->hasDATE) { struct NntpMboxData mdata; - char buf[LONG_STRING]; + char buf[1024]; struct tm tm; memset(&tm, 0, sizeof(tm)); @@ -1982,7 +1982,7 @@ int nntp_post(struct Mailbox *m, const char *msg) { struct NntpMboxData *mdata = NULL; struct NntpMboxData tmp_mdata = { 0 }; - char buf[LONG_STRING]; + char buf[1024]; if (m && (m->magic == MUTT_NNTP)) mdata = m->mdata; @@ -2064,7 +2064,7 @@ int nntp_active_fetch(struct NntpAccountData *adata, bool new) { struct NntpMboxData tmp_mdata; char msg[256]; - char buf[LONG_STRING]; + char buf[1024]; unsigned int i; int rc; @@ -2132,7 +2132,7 @@ int nntp_check_new_groups(struct Mailbox *m, struct NntpAccountData *adata) struct NntpMboxData tmp_mdata; time_t now; struct tm *tm = NULL; - char buf[LONG_STRING]; + char buf[1024]; char *msg = _("Checking for new newsgroups..."); unsigned int i; int rc, update_active = false; @@ -2247,7 +2247,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) struct Mailbox *m = ctx->mailbox; struct NntpMboxData *mdata = m->mdata; - char buf[LONG_STRING]; + char buf[1024]; FILE *fp = mutt_file_mkstemp(); if (!fp) @@ -2443,7 +2443,7 @@ static int nntp_mbox_open(struct Mailbox *m) return -1; char buf[HUGE_STRING]; - char server[LONG_STRING]; + char server[1024]; char *group = NULL; int rc; void *hc = NULL; diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index bfbcedd8f..7d5dbd30d 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -249,7 +249,7 @@ struct NmEmailData *nm_edata_new(void) struct NmMboxData *nm_get_default_data(void) { // path to DB + query + URI "decoration" - char uri[PATH_MAX + LONG_STRING + 32]; + char uri[PATH_MAX + 1024 + 32]; // Try to use C_NmDefaultUri or C_Folder. // If neither are set, it is impossible to create a Notmuch URI. @@ -496,7 +496,7 @@ static char *get_query_string(struct NmMboxData *mdata, bool window) if (window) { - char buf[LONG_STRING]; + char buf[1024]; mutt_str_replace(&C_NmQueryWindowCurrentSearch, mdata->db_query); /* if a date part is defined, do not apply windows (to avoid the risk of @@ -1686,7 +1686,7 @@ char *nm_uri_from_query(struct Mailbox *m, char *buf, size_t buflen) { mutt_debug(LL_DEBUG2, "(%s)\n", buf); struct NmMboxData *mdata = nm_mdata_get(m); - char uri[PATH_MAX + LONG_STRING + 32]; /* path to DB + query + URI "decoration" */ + char uri[PATH_MAX + 1024 + 32]; /* path to DB + query + URI "decoration" */ int added; bool using_default_data = false; diff --git a/pager.c b/pager.c index d403eb2b4..ca72a5d37 100644 --- a/pager.c +++ b/pager.c @@ -1921,7 +1921,7 @@ struct PagerRedrawData static void pager_custom_redraw(struct Menu *pager_menu) { struct PagerRedrawData *rd = pager_menu->redraw_data; - char buffer[LONG_STRING]; + char buffer[1024]; if (!rd) return; @@ -2229,7 +2229,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *extra) { static char searchbuf[256] = ""; - char buffer[LONG_STRING]; + char buffer[1024]; char helpstr[256]; char tmphelp[256]; int ch = 0, rc = -1; @@ -2436,7 +2436,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e beep(); if (C_NewMailCommand) { - char cmd[LONG_STRING]; + char cmd[1024]; menu_status_line(cmd, sizeof(cmd), rd.index, NONULL(C_NewMailCommand)); if (mutt_system(cmd) != 0) mutt_error(_("Error running \"%s\""), cmd); diff --git a/pattern.c b/pattern.c index 470d37784..a8efe7356 100644 --- a/pattern.c +++ b/pattern.c @@ -185,7 +185,7 @@ static struct RangeRegex range_regexes[] = { static struct Pattern *SearchPattern = NULL; /**< current search pattern */ static char LastSearch[256] = { 0 }; /**< last pattern searched for */ -static char LastSearchExpn[LONG_STRING] = { 0 }; /**< expanded version of LastSearch */ +static char LastSearchExpn[1024] = { 0 }; /**< expanded version of LastSearch */ /** * eat_regex - Parse a regex @@ -2254,7 +2254,7 @@ void mutt_check_simple(char *s, size_t len, const char *simple) mutt_str_strfcpy(s, "~U", len); else { - char tmp[LONG_STRING]; + char tmp[1024]; quote_simple(s, tmp, sizeof(tmp)); mutt_file_expand_fmt(s, len, simple, tmp); } @@ -2334,7 +2334,7 @@ bool mutt_limit_current_thread(struct Email *e) int mutt_pattern_func(int op, char *prompt) { struct Pattern *pat = NULL; - char buf[LONG_STRING] = "", *simple = NULL; + char buf[1024] = "", *simple = NULL; struct Buffer err; int rc = -1, padding; struct Progress progress; @@ -2491,7 +2491,7 @@ int mutt_search_command(int cur, int op) /* compare the *expanded* version of the search pattern in case $simple_search has changed while we were searching */ - char temp[LONG_STRING]; + char temp[1024]; mutt_str_strfcpy(temp, buf, sizeof(temp)); mutt_check_simple(temp, sizeof(temp), NONULL(C_SimpleSearch)); diff --git a/pop/pop.c b/pop/pop.c index ef4e893fd..3c253c2a1 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -189,7 +189,7 @@ static int pop_read_header(struct PopAccountData *adata, struct Email *e) int index = 0; size_t length = 0; - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), "LIST %d\r\n", e->refno); int rc = pop_query(adata, buf, sizeof(buf)); @@ -360,7 +360,7 @@ static header_cache_t *pop_hcache_open(struct PopAccountData *adata, const char return mutt_hcache_open(C_HeaderCache, path, NULL); struct Url url; - char p[LONG_STRING]; + char p[1024]; mutt_account_tourl(&adata->conn->account, &url); url.path = HC_FNAME; @@ -587,7 +587,7 @@ void pop_fetch_mail(void) return; } - char buffer[LONG_STRING]; + char buffer[1024]; char msgbuf[128]; int delanswer, last = 0, msgs, bytes, rset = 0, ret; struct ConnAccount acct; @@ -939,7 +939,7 @@ static int pop_mbox_sync(struct Mailbox *m, int *index_hint) return -1; int i, j, ret = 0; - char buf[LONG_STRING]; + char buf[1024]; struct PopAccountData *adata = pop_adata_get(m); struct Progress progress; #ifdef USE_HCACHE @@ -1058,7 +1058,7 @@ static int pop_msg_open(struct Mailbox *m, struct Message *msg, int msgno) if (!m) return -1; - char buf[LONG_STRING]; + char buf[1024]; char path[PATH_MAX]; struct Progress progressbar; struct PopAccountData *adata = pop_adata_get(m); diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 829a64ac5..51bccdc48 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -59,7 +59,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *m sasl_conn_t *saslconn = NULL; sasl_interact_t *interaction = NULL; int rc; - char inbuf[LONG_STRING]; + char inbuf[1024]; const char *mech = NULL; const char *pc = NULL; unsigned int len = 0, olen = 0, client_start; @@ -102,7 +102,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *m mutt_message(_("Authenticating (SASL)...")); - size_t bufsize = ((olen * 2) > LONG_STRING) ? (olen * 2) : LONG_STRING; + size_t bufsize = MAX((olen * 2), 1024); char *buf = mutt_mem_malloc(bufsize); snprintf(buf, bufsize, "AUTH %s", mech); @@ -234,7 +234,7 @@ static enum PopAuthRes pop_auth_apop(struct PopAccountData *adata, const char *m struct Md5Ctx mctx; unsigned char digest[16]; char hash[33]; - char buf[LONG_STRING]; + char buf[1024]; if (mutt_account_getpass(&adata->conn->account) || !adata->conn->account.pass[0]) return POP_A_FAILURE; @@ -289,7 +289,7 @@ static enum PopAuthRes pop_auth_user(struct PopAccountData *adata, const char *m mutt_message(_("Logging in...")); - char buf[LONG_STRING]; + char buf[1024]; snprintf(buf, sizeof(buf), "USER %s\r\n", adata->conn->account.user); int ret = pop_query(adata, buf, sizeof(buf)); @@ -374,7 +374,7 @@ static enum PopAuthRes pop_auth_oauth(struct PopAccountData *adata, const char * mutt_socket_send(adata->conn, "\001"); char *err = adata->err_msg; - char decoded_err[LONG_STRING]; + char decoded_err[1024]; int len = mutt_b64_decode(adata->err_msg, decoded_err, sizeof(decoded_err) - 1); if (len >= 0) { diff --git a/pop/pop_lib.c b/pop/pop_lib.c index fcfdbc127..5dd697748 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -188,7 +188,7 @@ static int fetch_auth(char *line, void *data) */ static int pop_capabilities(struct PopAccountData *adata, int mode) { - char buf[LONG_STRING]; + char buf[1024]; /* don't check capabilities on reconnect */ if (adata->capabilities) @@ -267,7 +267,7 @@ static int pop_capabilities(struct PopAccountData *adata, int mode) */ int pop_connect(struct PopAccountData *adata) { - char buf[LONG_STRING]; + char buf[1024]; adata->status = POP_NONE; if (mutt_socket_open(adata->conn) < 0 || @@ -302,7 +302,7 @@ int pop_connect(struct PopAccountData *adata) */ int pop_open_connection(struct PopAccountData *adata) { - char buf[LONG_STRING]; + char buf[1024]; int rc = pop_connect(adata); if (rc < 0) @@ -411,7 +411,7 @@ void pop_logout(struct Mailbox *m) if (adata->status == POP_CONNECTED) { int ret = 0; - char buf[LONG_STRING]; + char buf[1024]; mutt_message(_("Closing connection to POP server...")); if (m->readonly) @@ -493,7 +493,7 @@ int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *ms int pop_fetch_data(struct PopAccountData *adata, const char *query, struct Progress *progressbar, int (*func)(char *, void *), void *data) { - char buf[LONG_STRING]; + char buf[1024]; long pos = 0; size_t lenbuf = 0; diff --git a/postpone.c b/postpone.c index 7277aadff..4e5e7b111 100644 --- a/postpone.c +++ b/postpone.c @@ -216,7 +216,7 @@ static struct Email *select_msg(struct Context *ctx) { int r = -1; bool done = false; - char helpstr[LONG_STRING]; + char helpstr[1024]; struct Menu *menu = mutt_menu_new(MENU_POST); menu->menu_make_entry = post_make_entry; @@ -451,8 +451,8 @@ int mutt_get_postponed(struct Context *ctx, struct Email *hdr, */ int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app) { - char smime_cryptalg[LONG_STRING] = "\0"; - char sign_as[LONG_STRING] = "\0", *q = NULL; + char smime_cryptalg[1024] = "\0"; + char sign_as[1024] = "\0", *q = NULL; int flags = 0; if (!WithCrypto) diff --git a/query.c b/query.c index 8aea0ca51..cadc7626c 100644 --- a/query.c +++ b/query.c @@ -349,7 +349,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret menu->menu_search = query_search; menu->menu_tag = query_tag; menu->title = title; - char helpstr[LONG_STRING]; + char helpstr[1024]; menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_QUERY, QueryHelp); mutt_menu_push_current(menu); diff --git a/recvattach.c b/recvattach.c index af47da2c2..e3440f188 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1317,7 +1317,7 @@ static void attach_collapse(struct AttachCtx *actx, struct Menu *menu) */ void mutt_view_attachments(struct Email *e) { - char helpstr[LONG_STRING]; + char helpstr[1024]; struct Body *cur = NULL; int flags = 0; int op = OP_NULL; diff --git a/remailer.c b/remailer.c index 9e480d3cd..1af5e617f 100644 --- a/remailer.c +++ b/remailer.c @@ -564,7 +564,7 @@ void mix_make_chain(struct ListHead *chainhead) struct Coord *coords = NULL; struct Menu *menu = NULL; - char helpstr[LONG_STRING]; + char helpstr[1024]; bool loop = true; char *t = NULL; diff --git a/rfc1524.c b/rfc1524.c index 493f3003d..756049aa4 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -75,7 +75,7 @@ int rfc1524_expand_command(struct Body *a, const char *filename, int x = 0, y = 0; int needspipe = true; char buf[HUGE_STRING]; - char type2[LONG_STRING]; + char type2[1024]; mutt_str_strfcpy(type2, type, sizeof(type2)); diff --git a/rfc3676.c b/rfc3676.c index ae3ea56f0..e2ed8acc0 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -404,7 +404,7 @@ void rfc3676_space_stuff(struct Email *e) size_t len = 0; unsigned char c = '\0'; FILE *in = NULL, *out = NULL; - char buf[LONG_STRING]; + char buf[1024]; char tmpfile[PATH_MAX]; if (!e || !e->content || !e->content->filename) diff --git a/send.c b/send.c index c59f3b8fe..aea7f252b 100644 --- a/send.c +++ b/send.c @@ -457,7 +457,7 @@ void mutt_forward_intro(struct Mailbox *m, struct Email *e, FILE *fp) if (!C_ForwardAttributionIntro || !fp) return; - char buf[LONG_STRING]; + char buf[1024]; setlocale(LC_TIME, NONULL(C_AttributionLocale)); mutt_make_string(buf, sizeof(buf), C_ForwardAttributionIntro, NULL, m, e); setlocale(LC_TIME, ""); @@ -476,7 +476,7 @@ void mutt_forward_trailer(struct Mailbox *m, struct Email *e, FILE *fp) if (!C_ForwardAttributionTrailer || !fp) return; - char buf[LONG_STRING]; + char buf[1024]; setlocale(LC_TIME, NONULL(C_AttributionLocale)); mutt_make_string(buf, sizeof(buf), C_ForwardAttributionTrailer, NULL, m, e); setlocale(LC_TIME, ""); @@ -541,7 +541,7 @@ void mutt_make_attribution(struct Mailbox *m, struct Email *e, FILE *out) if (!C_Attribution || !out) return; - char buf[LONG_STRING]; + char buf[1024]; setlocale(LC_TIME, NONULL(C_AttributionLocale)); mutt_make_string(buf, sizeof(buf), C_Attribution, NULL, m, e); setlocale(LC_TIME, ""); @@ -1442,11 +1442,11 @@ static bool search_attach_keyword(char *filename) if (!attf) return false; - char *inputline = mutt_mem_malloc(LONG_STRING); + char *inputline = mutt_mem_malloc(1024); bool found = false; while (!feof(attf)) { - fgets(inputline, LONG_STRING, attf); + fgets(inputline, 1024, attf); if (!mutt_is_quote_line(inputline, NULL) && regexec(C_AbortNoattachRegex->regex, inputline, 0, NULL, 0) == 0) { @@ -1736,7 +1736,7 @@ static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, int int ci_send_message(int flags, struct Email *msg, const char *tempfile, struct Context *ctx, struct EmailList *el) { - char buf[LONG_STRING]; + char buf[1024]; char fcc[PATH_MAX] = ""; /* where to copy this message */ FILE *tempfp = NULL; struct Body *pbody = NULL; diff --git a/sendlib.c b/sendlib.c index d7a91eff1..75eb6b363 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1462,7 +1462,7 @@ void mutt_update_encoding(struct Body *a) */ struct Body *mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool attach_msg) { - char buf[LONG_STRING]; + char buf[1024]; struct Body *body = NULL; FILE *fp = NULL; int cmflags, chflags; @@ -1743,7 +1743,7 @@ struct Body *mutt_remove_multipart(struct Body *b) void mutt_write_address_list(struct Address *addr, FILE *fp, int linelen, bool display) { struct Address *tmp = NULL; - char buf[LONG_STRING]; + char buf[1024]; int count = 0; while (addr) @@ -2217,7 +2217,7 @@ int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, struct Body *attach, enum MuttWriteHeaderMode mode, bool privacy, bool hide_protected_subject) { - char buf[LONG_STRING]; + char buf[1024]; char *p = NULL, *q = NULL; bool has_agent = false; /* user defined user-agent header field exists */ @@ -2727,7 +2727,7 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres #ifdef USE_NNTP if (OptNewsSend) { - char cmd[LONG_STRING]; + char cmd[1024]; mutt_expando_format(cmd, sizeof(cmd), 0, MuttIndexWindow->cols, NONULL(C_Inews), nntp_format_str, 0, 0); @@ -2905,7 +2905,7 @@ void mutt_prepare_envelope(struct Envelope *env, bool final) env->to->group = 1; env->to->next = mutt_addr_new(); - char buf[LONG_STRING]; + char buf[1024]; buf[0] = 0; mutt_addr_cat(buf, sizeof(buf), "undisclosed-recipients", AddressSpecials); @@ -3291,7 +3291,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, if (tempfp) { - char sasha[LONG_STRING]; + char sasha[1024]; int lines = 0; mutt_write_mime_body(e->content, tempfp); diff --git a/smtp.c b/smtp.c index 727451ac7..ee1d6d666 100644 --- a/smtp.c +++ b/smtp.c @@ -364,7 +364,7 @@ static int smtp_fill_account(struct ConnAccount *account) */ static int smtp_helo(struct Connection *conn, bool esmtp) { - char buf[LONG_STRING]; + char buf[1024]; const char *fqdn = NULL; Capabilities = 0; @@ -433,7 +433,7 @@ static int smtp_auth_sasl(struct Connection *conn, const char *mechlist) if (!OptNoCurses) mutt_message(_("Authenticating (%s)..."), mech); - bufsize = ((len * 2) > LONG_STRING) ? (len * 2) : LONG_STRING; + bufsize = MAX((len * 2), 1024); buf = mutt_mem_malloc(bufsize); snprintf(buf, bufsize, "AUTH %s", mech); @@ -543,7 +543,7 @@ static int smtp_auth_oauth(struct Connection *conn) */ static int smtp_auth_plain(struct Connection *conn) { - char buf[LONG_STRING]; + char buf[1024]; /* Get username and password. Bail out of any cannot be retrieved. */ if ((mutt_account_getuser(&conn->account) < 0) ||