From 7679d0407f49cc5fc0792b8b37db701c8aa4b30c Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 23 Feb 2019 11:58:14 +0000 Subject: [PATCH] replace SHORT_STRING with 128 --- addrbook.c | 2 +- alias.c | 2 +- browser.c | 8 ++--- color.c | 2 +- commands.c | 6 ++-- compose.c | 4 +-- conn/sasl.c | 4 +-- conn/ssl.c | 28 +++++++++--------- conn/ssl_gnutls.c | 69 ++++++++++++++++++++++---------------------- copy.c | 8 ++--- email/parse.c | 2 +- handler.c | 6 ++-- hcache/kc.c | 3 +- hdrline.c | 2 +- help.c | 8 ++--- imap/message.c | 4 +-- keymap.c | 4 +-- menu.c | 4 +-- mutt/charset.c | 6 ++-- mutt/date.c | 4 +-- mutt/path.c | 2 +- mutt/string.c | 4 +-- mutt/string2.h | 1 - muttlib.c | 4 +-- mx.c | 2 +- ncrypt/crypt_gpgme.c | 12 ++++---- ncrypt/pgp.c | 2 +- ncrypt/pgpinvoke.c | 4 +-- ncrypt/pgpkey.c | 6 ++-- ncrypt/smime.c | 4 +-- nntp/browse.c | 2 +- nntp/newsrc.c | 2 +- pager.c | 4 +-- pop/pop.c | 4 +-- progress.c | 2 +- progress.h | 2 +- query.c | 2 +- recvattach.c | 12 ++++---- recvcmd.c | 4 +-- remailer.c | 2 +- rfc1524.c | 2 +- sendlib.c | 12 ++++---- sort.c | 12 ++++---- status.c | 2 +- 44 files changed, 140 insertions(+), 141 deletions(-) diff --git a/addrbook.c b/addrbook.c index b23a3c818..811c54bb1 100644 --- a/addrbook.c +++ b/addrbook.c @@ -73,7 +73,7 @@ static const char *alias_format_str(char *buf, size_t buflen, size_t col, int co const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING], addr[SHORT_STRING]; + char fmt[128], addr[128]; struct Alias *alias = (struct Alias *) data; switch (op) diff --git a/alias.c b/alias.c index 1116a7178..ef32b6ffb 100644 --- a/alias.c +++ b/alias.c @@ -368,7 +368,7 @@ 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[SHORT_STRING], *pc = NULL; + char buf[LONG_STRING], tmp[LONG_STRING], prompt[128], *pc = NULL; char *err = NULL; char fixed[LONG_STRING]; FILE *rc = NULL; diff --git a/browser.c b/browser.c index c63864b4a..9007fec3b 100644 --- a/browser.c +++ b/browser.c @@ -360,7 +360,7 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c const char *if_str, const char *else_str, unsigned long data, int flags) { - char fn[SHORT_STRING], fmt[SHORT_STRING], permission[11]; + char fn[128], fmt[128], permission[11]; char *t_fmt = NULL; struct Folder *folder = (struct Folder *) data; struct passwd *pw = NULL; @@ -397,7 +397,7 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c if (!do_locales) setlocale(LC_TIME, "C"); - char date[SHORT_STRING]; + char date[128]; strftime(date, sizeof(date), t_fmt, localtime(&folder->ff->mtime)); if (!do_locales) setlocale(LC_TIME, ""); @@ -703,7 +703,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, struct stat s; DIR *dp = NULL; struct dirent *de = NULL; - char buffer[PATH_MAX + SHORT_STRING]; + char buffer[PATH_MAX + 128]; while (stat(d, &s) == -1) { @@ -1563,7 +1563,7 @@ void mutt_select_file(char *file, size_t filelen, int flags, char ***files, int mutt_error(_("Delete is only supported for IMAP mailboxes")); else { - char msg[SHORT_STRING]; + char msg[128]; int nentry = menu->current; // TODO(sileht): It could be better to select INBOX instead. But I diff --git a/color.c b/color.c index 15af9cd06..abaf8ed47 100644 --- a/color.c +++ b/color.c @@ -321,7 +321,7 @@ int mutt_alloc_color(int fg, int bg) #ifdef USE_SLANG_CURSES if (fg == COLOR_DEFAULT || bg == COLOR_DEFAULT) { - char fgc[SHORT_STRING], bgc[SHORT_STRING]; + char fgc[128], bgc[128]; SLtt_set_color(i, NULL, get_color_name(fgc, sizeof(fgc), fg), get_color_name(bgc, sizeof(bgc), bg)); } diff --git a/commands.c b/commands.c index ff5a10dff..f04454ba8 100644 --- a/commands.c +++ b/commands.c @@ -372,8 +372,8 @@ void ci_bounce_message(struct Mailbox *m, struct EmailList *el) if (!m || !el || STAILQ_EMPTY(el)) return; - char prompt[SHORT_STRING]; - char scratch[SHORT_STRING]; + char prompt[128]; + char scratch[128]; char buf[HUGE_STRING] = { 0 }; struct Address *addr = NULL; char *err = NULL; @@ -859,7 +859,7 @@ void mutt_enter_command(void) void mutt_display_address(struct Envelope *env) { const char *pfx = NULL; - char buf[SHORT_STRING]; + char buf[128]; struct Address *addr = mutt_get_address(env, &pfx); if (!addr) diff --git a/compose.c b/compose.c index db6240639..339469d34 100644 --- a/compose.c +++ b/compose.c @@ -402,7 +402,7 @@ static int check_attachments(struct AttachCtx *actx) { int r; struct stat st; - char pretty[PATH_MAX], msg[PATH_MAX + SHORT_STRING]; + char pretty[PATH_MAX], msg[PATH_MAX + 128]; for (int i = 0; i < actx->idxlen; i++) { @@ -813,7 +813,7 @@ static const char *compose_format_str(char *buf, size_t buflen, size_t col, int const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING]; + char fmt[128], tmp[128]; int optional = (flags & MUTT_FORMAT_OPTIONAL); struct Menu *menu = (struct Menu *) data; diff --git a/conn/sasl.c b/conn/sasl.c index 7a26af601..dec27d2bf 100644 --- a/conn/sasl.c +++ b/conn/sasl.c @@ -642,8 +642,8 @@ int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn) */ int mutt_sasl_interact(sasl_interact_t *interaction) { - char prompt[SHORT_STRING]; - char resp[SHORT_STRING]; + char prompt[128]; + char resp[128]; while (interaction->id != SASL_CB_LIST_END) { diff --git a/conn/ssl.c b/conn/ssl.c index aac3caaf0..9a144bd9c 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -66,6 +66,8 @@ #include "protos.h" #include "socket.h" +const int dialog_row_len = 128; + /* Just in case OpenSSL doesn't define DEVRANDOM */ #ifndef DEVRANDOM #define DEVRANDOM "/dev/urandom" @@ -393,7 +395,7 @@ static int ssl_socket_open_err(struct Connection *conn) */ static char *x509_get_part(X509_NAME *name, int nid) { - static char data[SHORT_STRING]; + static char data[128]; if (!name || X509_NAME_get_text_by_NID(name, nid, data, sizeof(data)) < 0) mutt_str_strfcpy(data, _("Unknown"), sizeof(data)); @@ -900,45 +902,43 @@ static bool interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, bo menu->max = mutt_array_size(part) * 2 + 11; menu->dialog = mutt_mem_calloc(1, menu->max * sizeof(char *)); for (int i = 0; i < menu->max; i++) - menu->dialog[i] = mutt_mem_calloc(1, SHORT_STRING * sizeof(char)); + menu->dialog[i] = mutt_mem_calloc(1, dialog_row_len * sizeof(char)); row = 0; - mutt_str_strfcpy(menu->dialog[row], _("This certificate belongs to:"), SHORT_STRING); + mutt_str_strfcpy(menu->dialog[row], _("This certificate belongs to:"), dialog_row_len); row++; x509_subject = X509_get_subject_name(cert); for (unsigned int u = 0; u < mutt_array_size(part); u++) { - snprintf(menu->dialog[row++], SHORT_STRING, " %s", - x509_get_part(x509_subject, part[u])); + snprintf(menu->dialog[row++], dialog_row_len, " %s", x509_get_part(x509_subject, part[u])); } row++; - mutt_str_strfcpy(menu->dialog[row], _("This certificate was issued by:"), SHORT_STRING); + mutt_str_strfcpy(menu->dialog[row], _("This certificate was issued by:"), dialog_row_len); row++; x509_issuer = X509_get_issuer_name(cert); for (unsigned int u = 0; u < mutt_array_size(part); u++) { - snprintf(menu->dialog[row++], SHORT_STRING, " %s", - x509_get_part(x509_issuer, part[u])); + snprintf(menu->dialog[row++], dialog_row_len, " %s", x509_get_part(x509_issuer, part[u])); } row++; - snprintf(menu->dialog[row++], SHORT_STRING, "%s", _("This certificate is valid")); - snprintf(menu->dialog[row++], SHORT_STRING, _(" from %s"), + snprintf(menu->dialog[row++], dialog_row_len, "%s", _("This certificate is valid")); + snprintf(menu->dialog[row++], dialog_row_len, _(" from %s"), asn1time_to_string(X509_getm_notBefore(cert))); - snprintf(menu->dialog[row++], SHORT_STRING, _(" to %s"), + snprintf(menu->dialog[row++], dialog_row_len, _(" to %s"), asn1time_to_string(X509_getm_notAfter(cert))); row++; buf[0] = '\0'; x509_fingerprint(buf, sizeof(buf), cert, EVP_sha1); - snprintf(menu->dialog[row++], SHORT_STRING, _("SHA1 Fingerprint: %s"), buf); + snprintf(menu->dialog[row++], dialog_row_len, _("SHA1 Fingerprint: %s"), buf); buf[0] = '\0'; buf[40] = '\0'; /* Ensure the second printed line is null terminated */ x509_fingerprint(buf, sizeof(buf), cert, EVP_sha256); buf[39] = '\0'; /* Divide into two lines of output */ - snprintf(menu->dialog[row++], SHORT_STRING, "%s%s", _("SHA256 Fingerprint: "), buf); - snprintf(menu->dialog[row++], SHORT_STRING, "%*s%s", + snprintf(menu->dialog[row++], dialog_row_len, "%s%s", _("SHA256 Fingerprint: "), buf); + snprintf(menu->dialog[row++], dialog_row_len, "%*s%s", (int) mutt_str_strlen(_("SHA256 Fingerprint: ")), "", buf + 40); snprintf(title, sizeof(title), diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 232b65d4e..0e4d9782f 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -62,6 +62,8 @@ #define CERTERR_INSECUREALG 64 #define CERTERR_OTHER 128 +const int dialog_row_len = 128; + #define CERT_SEP "-----BEGIN" static int tls_socket_close(struct Connection *conn); @@ -444,16 +446,16 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, { int certerr, savedcert; gnutls_x509_crt_t cert; - char buf[SHORT_STRING]; - char fpbuf[SHORT_STRING]; + char buf[128]; + char fpbuf[128]; size_t buflen; - char dn_common_name[SHORT_STRING]; - char dn_email[SHORT_STRING]; - char dn_organization[SHORT_STRING]; - char dn_organizational_unit[SHORT_STRING]; - char dn_locality[SHORT_STRING]; - char dn_province[SHORT_STRING]; - char dn_country[SHORT_STRING]; + char dn_common_name[128]; + char dn_email[128]; + char dn_organization[128]; + char dn_organizational_unit[128]; + char dn_locality[128]; + char dn_province[128]; + char dn_country[128]; time_t t; char datestr[30]; struct Menu *menu = NULL; @@ -484,11 +486,11 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, menu->max = 27; menu->dialog = mutt_mem_calloc(1, menu->max * sizeof(char *)); for (int i = 0; i < menu->max; i++) - menu->dialog[i] = mutt_mem_calloc(1, SHORT_STRING * sizeof(char)); + menu->dialog[i] = mutt_mem_calloc(1, dialog_row_len * sizeof(char)); mutt_menu_push_current(menu); row = 0; - mutt_str_strfcpy(menu->dialog[row], _("This certificate belongs to:"), SHORT_STRING); + mutt_str_strfcpy(menu->dialog[row], _("This certificate belongs to:"), dialog_row_len); row++; buflen = sizeof(dn_common_name); @@ -531,14 +533,13 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, dn_country[0] = '\0'; } - snprintf(menu->dialog[row++], SHORT_STRING, " %s %s", dn_common_name, dn_email); - snprintf(menu->dialog[row++], SHORT_STRING, " %s", dn_organization); - snprintf(menu->dialog[row++], SHORT_STRING, " %s", dn_organizational_unit); - snprintf(menu->dialog[row++], SHORT_STRING, " %s %s %s", dn_locality, - dn_province, dn_country); + snprintf(menu->dialog[row++], dialog_row_len, " %s %s", dn_common_name, dn_email); + snprintf(menu->dialog[row++], dialog_row_len, " %s", dn_organization); + snprintf(menu->dialog[row++], dialog_row_len, " %s", dn_organizational_unit); + snprintf(menu->dialog[row++], dialog_row_len, " %s %s %s", dn_locality, dn_province, dn_country); row++; - mutt_str_strfcpy(menu->dialog[row], _("This certificate was issued by:"), SHORT_STRING); + mutt_str_strfcpy(menu->dialog[row], _("This certificate was issued by:"), dialog_row_len); row++; buflen = sizeof(dn_common_name); @@ -584,63 +585,63 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, dn_country[0] = '\0'; } - snprintf(menu->dialog[row++], SHORT_STRING, " %s %s", dn_common_name, dn_email); - snprintf(menu->dialog[row++], SHORT_STRING, " %s", dn_organization); - snprintf(menu->dialog[row++], SHORT_STRING, " %s", dn_organizational_unit); - snprintf(menu->dialog[row++], SHORT_STRING, " %s %s %s", dn_locality, + snprintf(menu->dialog[row++], dialog_row_len, " %s %s", dn_common_name, dn_email); + snprintf(menu->dialog[row++], dialog_row_len, " %s", dn_organization); + snprintf(menu->dialog[row++], dialog_row_len, " %s", dn_organizational_unit); + snprintf(menu->dialog[row++], dialog_row_len, " %s %s %s", dn_locality, dn_province, dn_country); row++; - snprintf(menu->dialog[row++], SHORT_STRING, _("This certificate is valid")); + snprintf(menu->dialog[row++], dialog_row_len, _("This certificate is valid")); t = gnutls_x509_crt_get_activation_time(cert); mutt_date_make_tls(datestr, sizeof(datestr), t); - snprintf(menu->dialog[row++], SHORT_STRING, _(" from %s"), datestr); + snprintf(menu->dialog[row++], dialog_row_len, _(" from %s"), datestr); t = gnutls_x509_crt_get_expiration_time(cert); mutt_date_make_tls(datestr, sizeof(datestr), t); - snprintf(menu->dialog[row++], SHORT_STRING, _(" to %s"), datestr); + snprintf(menu->dialog[row++], dialog_row_len, _(" to %s"), datestr); fpbuf[0] = '\0'; tls_fingerprint(GNUTLS_DIG_SHA, fpbuf, sizeof(fpbuf), certdata); - snprintf(menu->dialog[row++], SHORT_STRING, _("SHA1 Fingerprint: %s"), fpbuf); + snprintf(menu->dialog[row++], dialog_row_len, _("SHA1 Fingerprint: %s"), fpbuf); fpbuf[0] = '\0'; fpbuf[40] = '\0'; /* Ensure the second printed line is null terminated */ tls_fingerprint(GNUTLS_DIG_SHA256, fpbuf, sizeof(fpbuf), certdata); fpbuf[39] = '\0'; /* Divide into two lines of output */ - snprintf(menu->dialog[row++], SHORT_STRING, "%s%s", _("SHA256 Fingerprint: "), fpbuf); - snprintf(menu->dialog[row++], SHORT_STRING, "%*s%s", + snprintf(menu->dialog[row++], dialog_row_len, "%s%s", _("SHA256 Fingerprint: "), fpbuf); + snprintf(menu->dialog[row++], dialog_row_len, "%*s%s", (int) mutt_str_strlen(_("SHA256 Fingerprint: ")), "", fpbuf + 40); if (certerr & CERTERR_NOTYETVALID) { row++; mutt_str_strfcpy(menu->dialog[row], - _("WARNING: Server certificate is not yet valid"), SHORT_STRING); + _("WARNING: Server certificate is not yet valid"), dialog_row_len); } if (certerr & CERTERR_EXPIRED) { row++; mutt_str_strfcpy(menu->dialog[row], - _("WARNING: Server certificate has expired"), SHORT_STRING); + _("WARNING: Server certificate has expired"), dialog_row_len); } if (certerr & CERTERR_REVOKED) { row++; mutt_str_strfcpy(menu->dialog[row], - _("WARNING: Server certificate has been revoked"), SHORT_STRING); + _("WARNING: Server certificate has been revoked"), dialog_row_len); } if (certerr & CERTERR_HOSTNAME) { row++; mutt_str_strfcpy(menu->dialog[row], - _("WARNING: Server hostname does not match certificate"), SHORT_STRING); + _("WARNING: Server hostname does not match certificate"), dialog_row_len); } if (certerr & CERTERR_SIGNERNOTCA) { row++; mutt_str_strfcpy(menu->dialog[row], - _("WARNING: Signer of server certificate is not a CA"), SHORT_STRING); + _("WARNING: Signer of server certificate is not a CA"), dialog_row_len); } snprintf(title, sizeof(title), @@ -894,7 +895,7 @@ static int tls_set_priority(struct TlsSockData *data) size_t nproto = 4; size_t priority_size; - priority_size = SHORT_STRING + mutt_str_strlen(C_SslCiphers); + priority_size = mutt_str_strlen(C_SslCiphers) + 128; char *priority = mutt_mem_malloc(priority_size); priority[0] = 0; @@ -985,7 +986,7 @@ static int tls_set_priority(struct TlsSockData *data) { row++; strfcpy(menu->dialog[row], _("Warning: Server certificate was signed using an insecure algorithm"), - SHORT_STRING); + dialog_row_len); } /* We use default priorities (see gnutls documentation), diff --git a/copy.c b/copy.c index 0bd1d9523..c1ef2b05c 100644 --- a/copy.c +++ b/copy.c @@ -403,8 +403,8 @@ int mutt_copy_header(FILE *in, struct Email *e, FILE *out, int chflags, const ch if (chflags & CH_TXTPLAIN) { - char chsbuf[SHORT_STRING]; - char buffer[SHORT_STRING]; + char chsbuf[128]; + char buffer[128]; fputs("MIME-Version: 1.0\n", out); fputs("Content-Transfer-Encoding: 8bit\n", out); fputs("Content-Type: text/plain; charset=", out); @@ -590,7 +590,7 @@ static int count_delete_lines(FILE *fp, struct Body *b, LOFF_T *length, size_t d int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Email *e, int cmflags, int chflags) { struct Body *body = e->content; - char prefix[SHORT_STRING]; + char prefix[128]; LOFF_T new_offset = -1; int rc = 0; @@ -612,7 +612,7 @@ int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Email *e, int cmflags, { int new_lines; LOFF_T new_length = body->length; - char date[SHORT_STRING]; + char date[128]; mutt_date_make_date(date, sizeof(date)); int dlen = mutt_str_strlen(date); diff --git a/email/parse.c b/email/parse.c index 1d0b3935c..aede55309 100644 --- a/email/parse.c +++ b/email/parse.c @@ -496,7 +496,7 @@ void mutt_parse_content_type(const char *s, struct Body *ct) ct->subtype = mutt_str_strdup("rfc822"); else if (ct->type == TYPE_OTHER) { - char buffer[SHORT_STRING]; + char buffer[128]; ct->type = TYPE_APPLICATION; snprintf(buffer, sizeof(buffer), "x-%s", s); diff --git a/handler.c b/handler.c index 42a15992f..27490d2da 100644 --- a/handler.c +++ b/handler.c @@ -370,7 +370,7 @@ static unsigned char decode_byte(char ch) */ static void decode_uuencoded(struct State *s, long len, bool istext, iconv_t cd) { - char tmps[SHORT_STRING]; + char tmps[128]; char *pt = NULL; char bufi[BUFI_SIZE]; size_t k = 0; @@ -481,7 +481,7 @@ static bool is_mmnoask(const char *buf) */ static bool is_autoview(struct Body *b) { - char type[SHORT_STRING]; + char type[128]; bool is_av = false; snprintf(type, sizeof(type), "%s/%s", TYPE(b), b->subtype); @@ -1647,7 +1647,7 @@ int mutt_body_handler(struct Body *b, struct State *s) C_HonorDisposition && (plaintext || handler))) { const char *str = NULL; - char keystroke[SHORT_STRING]; + char keystroke[128]; keystroke[0] = '\0'; if (!OptViewAttach) diff --git a/hcache/kc.c b/hcache/kc.c index 02df72ada..58d7a95d2 100644 --- a/hcache/kc.c +++ b/hcache/kc.c @@ -148,8 +148,7 @@ static void hcache_kyotocabinet_close(void **ctx) */ static const char *hcache_kyotocabinet_backend(void) { - /* SHORT_STRING(128) should be more than enough for KCVERSION */ - static char version_cache[SHORT_STRING] = ""; + static char version_cache[128] = ""; ///< should be more than enough for KCVERSION if (!version_cache[0]) snprintf(version_cache, sizeof(version_cache), "kyotocabinet %s", KCVERSION); diff --git a/hdrline.c b/hdrline.c index cc932adf6..1c16464cb 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[SHORT_STRING], tmp[LONG_STRING], *p, *tags = NULL; + char fmt[128], tmp[LONG_STRING], *p, *tags = NULL; const char *wch = NULL; int i; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/help.c b/help.c index 9afb96e68..35adeb7fb 100644 --- a/help.c +++ b/help.c @@ -87,11 +87,11 @@ static const struct Binding *help_lookup_function(int op, int menu) * @param menu Current Menu * @param op Operation, e.g. OP_DELETE * - * This will return something like: "buf:delete" + * This will return something like: "d:delete" */ void mutt_make_help(char *buf, size_t buflen, const char *txt, int menu, int op) { - char tmp[SHORT_STRING]; + char tmp[128]; if (km_expand_key(tmp, sizeof(tmp), km_find_func(menu, op)) || km_expand_key(tmp, sizeof(tmp), km_find_func(MENU_GENERIC, op))) @@ -374,7 +374,7 @@ static void dump_menu(FILE *f, int menu) { struct Keymap *map = NULL; const struct Binding *b = NULL; - char buf[SHORT_STRING]; + char buf[128]; /* browse through the keymap table */ for (map = Keymaps[menu]; map; map = map->next) @@ -438,7 +438,7 @@ static void dump_unbound(FILE *f, const struct Binding *funcs, void mutt_help(int menu) { char t[PATH_MAX]; - char buf[SHORT_STRING]; + char buf[128]; FILE *f = NULL; mutt_mktemp(t, sizeof(t)); diff --git a/imap/message.c b/imap/message.c index 2fadaf414..0358a625c 100644 --- a/imap/message.c +++ b/imap/message.c @@ -326,7 +326,7 @@ static char *msg_parse_flags(struct ImapHeader *h, char *s) */ static int msg_parse_fetch(struct ImapHeader *h, char *s) { - char tmp[SHORT_STRING]; + char tmp[128]; char *ptmp = NULL; size_t plen = 0; @@ -1419,7 +1419,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) FILE *fp = NULL; char buf[LONG_STRING * 2]; char internaldate[IMAP_DATELEN]; - char imap_flags[SHORT_STRING]; + char imap_flags[128]; size_t len; struct Progress progressbar; size_t sent; diff --git a/keymap.c b/keymap.c index 95f05e5c2..ee3499ba3 100644 --- a/keymap.c +++ b/keymap.c @@ -223,7 +223,7 @@ static size_t parsekeys(const char *str, keycode_t *d, size_t max) { int n; size_t len = max; - char buf[SHORT_STRING]; + char buf[128]; char c; char *t = NULL; @@ -1033,7 +1033,7 @@ void km_init(void) */ void km_error_key(int menu) { - char buf[SHORT_STRING]; + char buf[128]; int p, op; struct Keymap *key = km_find_func(menu, OP_HELP); diff --git a/menu.c b/menu.c index fe864a26a..fbcfbf7fb 100644 --- a/menu.c +++ b/menu.c @@ -630,7 +630,7 @@ static void menu_jump(struct Menu *menu) if (menu->max) { mutt_unget_event(LastKey, 0); - char buf[SHORT_STRING]; + char buf[128]; buf[0] = '\0'; if (mutt_get_field(_("Jump to: "), buf, sizeof(buf), 0) == 0 && buf[0]) { @@ -1145,7 +1145,7 @@ static int menu_search(struct Menu *menu, int op) int r = 0, wrap = 0; int search_dir; regex_t re; - char buf[SHORT_STRING]; + char buf[128]; char *search_buf = menu->menu >= 0 && menu->menu < MENU_MAX ? SearchBuffers[menu->menu] : NULL; diff --git a/mutt/charset.c b/mutt/charset.c index 6bef17c3d..d31f1ca20 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -400,7 +400,7 @@ bool mutt_ch_chscmp(const char *cs1, const char *cs2) */ char *mutt_ch_get_default_charset(void) { - static char fcharset[SHORT_STRING]; + static char fcharset[128]; const char *c = C_AssumedCharset; const char *c1 = NULL; @@ -530,8 +530,8 @@ const char *mutt_ch_charset_lookup(const char *chs) */ iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, int flags) { - char tocode1[SHORT_STRING]; - char fromcode1[SHORT_STRING]; + char tocode1[128]; + char fromcode1[128]; const char *tocode2 = NULL, *fromcode2 = NULL; const char *tmp = NULL; diff --git a/mutt/date.c b/mutt/date.c index 70b67f2f0..83790343d 100644 --- a/mutt/date.c +++ b/mutt/date.c @@ -451,8 +451,8 @@ time_t mutt_date_parse_date(const char *s, struct Tz *tz_out) int zminutes = 0; bool zoccident = false; const char *ptz = NULL; - char tzstr[SHORT_STRING]; - char scratch[SHORT_STRING]; + char tzstr[128]; + char scratch[128]; /* Don't modify our argument. Fixed-size buffer is ok here since * the date format imposes a natural limit. diff --git a/mutt/path.c b/mutt/path.c index c5045d020..ec51970e7 100644 --- a/mutt/path.c +++ b/mutt/path.c @@ -241,7 +241,7 @@ bool mutt_path_canon(char *buf, size_t buflen, const char *homedir) } else { - char user[SHORT_STRING]; + char user[128]; dir = strchr(buf + 1, '/'); if (dir) mutt_str_strfcpy(user, buf + 1, MIN(dir - buf, (unsigned) sizeof(user))); diff --git a/mutt/string.c b/mutt/string.c index b38e05207..d3c725bef 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -948,10 +948,10 @@ const char *mutt_str_rstrnstr(const char *haystack, size_t haystack_length, cons */ int mutt_str_word_casecmp(const char *a, const char *b) { - char tmp[SHORT_STRING] = ""; + char tmp[128] = ""; int i; - for (i = 0; i < (SHORT_STRING - 2); i++, b++) + for (i = 0; i < (sizeof(tmp) - 2); i++, b++) { if (!*b || ISSPACE(*b)) { diff --git a/mutt/string2.h b/mutt/string2.h index 4a9380e2d..a07a9208d 100644 --- a/mutt/string2.h +++ b/mutt/string2.h @@ -31,7 +31,6 @@ #include #include -#define SHORT_STRING 128 #define STRING 256 #define LONG_STRING 1024 #define HUGE_STRING 8192 diff --git a/muttlib.c b/muttlib.c index ba6206781..864c352ce 100644 --- a/muttlib.c +++ b/muttlib.c @@ -817,8 +817,8 @@ 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[SHORT_STRING], tmp[LONG_STRING], *cp = NULL, *wptr = buf, ch; - char if_str[SHORT_STRING], else_str[SHORT_STRING]; + char prefix[128], tmp[LONG_STRING], *cp = NULL, *wptr = buf, ch; + char if_str[128], else_str[128]; size_t wlen, count, len, wid; FILE *filter = NULL; char *recycler = NULL; diff --git a/mx.c b/mx.c index deb1b0f7e..ac12922b9 100644 --- a/mx.c +++ b/mx.c @@ -829,7 +829,7 @@ int mx_mbox_sync(struct Mailbox *m, int *index_hint) if (m->msg_deleted != 0) { - char buf[SHORT_STRING]; + char buf[128]; snprintf(buf, sizeof(buf), ngettext("Purge %d deleted message?", "Purge %d deleted messages?", m->msg_deleted), diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 86b633dc7..b43dec356 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -2019,7 +2019,7 @@ static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile if (non_pka_notations) { - char buf[SHORT_STRING]; + char buf[128]; snprintf(buf, sizeof(buf), _("*** Begin Notation (signature by: %s) ***\n"), sig->fpr); state_puts(buf, s); @@ -3311,7 +3311,7 @@ static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int co const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; + char fmt[128]; int kflags = 0; int optional = (flags & MUTT_FORMAT_OPTIONAL); const char *s = NULL; @@ -3437,7 +3437,7 @@ static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int co case '[': { - char buf2[SHORT_STRING]; + char buf2[128]; bool do_locales = true; struct tm *tm = NULL; size_t len; @@ -4070,7 +4070,7 @@ static void print_key_info(gpgme_key_t key, FILE *fp) const char *s = NULL, *s2 = NULL; time_t tt = 0; struct tm *tm = NULL; - char shortbuf[SHORT_STRING]; + char shortbuf[128]; unsigned long aval = 0; const char *delim = NULL; int is_pgp = 0; @@ -5041,7 +5041,7 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab unsigned int app, int *forced_valid) { struct CryptKeyInfo *key = NULL; - char resp[SHORT_STRING]; + char resp[128]; struct CryptCache *l = NULL; int dummy; @@ -5463,7 +5463,7 @@ static int gpgme_send_menu(struct Email *msg, int is_smime) is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL); if (p) { - char input_signas[SHORT_STRING]; + char input_signas[128]; snprintf(input_signas, sizeof(input_signas), "0x%s", crypt_fpr_or_lkeyid(p)); mutt_str_replace(is_smime ? &C_SmimeDefaultKey : &C_PgpSignAs, input_signas); crypt_free_key(&p); diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index b9e9734aa..68259db87 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -1974,7 +1974,7 @@ int pgp_class_send_menu(struct Email *msg) p = pgp_ask_for_key(_("Sign as: "), NULL, 0, PGP_SECRING); if (p) { - char input_signas[SHORT_STRING]; + char input_signas[128]; snprintf(input_signas, sizeof(input_signas), "0x%s", pgp_fpr_or_lkeyid(p)); mutt_str_replace(&C_PgpSignAs, input_signas); pgp_free_key(&p); diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index b8c1e1e7c..e410ed7fe 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -96,7 +96,7 @@ static const char *fmt_pgp_command(char *buf, size_t buflen, size_t col, int col const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; + char fmt[128]; struct PgpCommandContext *cctx = (struct PgpCommandContext *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); @@ -398,7 +398,7 @@ pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr, */ void pgp_class_invoke_import(const char *fname) { - char tmp_fname[PATH_MAX + SHORT_STRING]; + char tmp_fname[PATH_MAX + 128]; char cmd[HUGE_STRING]; struct PgpCommandContext cctx = { 0 }; diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 92d83546f..71ca91f65 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -176,7 +176,7 @@ static const char *pgp_entry_fmt(char *buf, size_t buflen, size_t col, int cols, const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; + char fmt[128]; int kflags = 0; int optional = (flags & MUTT_FORMAT_OPTIONAL); @@ -260,7 +260,7 @@ static const char *pgp_entry_fmt(char *buf, size_t buflen, size_t col, int cols, case '[': { - char buf2[SHORT_STRING]; + char buf2[128]; bool do_locales = true; struct tm *tm = NULL; size_t len; @@ -819,7 +819,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring) { struct PgpKeyInfo *key = NULL; - char resp[SHORT_STRING]; + char resp[128]; struct PgpCache *l = NULL; mutt_clear_error(); diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 8b58d1720..50d85963a 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -214,7 +214,7 @@ static const char *fmt_smime_command(char *buf, size_t buflen, size_t col, int c const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; + char fmt[128]; struct SmimeCommandContext *cctx = (struct SmimeCommandContext *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); @@ -912,7 +912,7 @@ static struct SmimeKey *smime_get_key_by_str(char *str, short abilities, bool pu static struct SmimeKey *smime_ask_for_key(char *prompt, short abilities, bool public) { struct SmimeKey *key = NULL; - char resp[SHORT_STRING]; + char resp[128]; if (!prompt) prompt = _("Enter keyID: "); diff --git a/nntp/browse.c b/nntp/browse.c index d10b4321a..d30544752 100644 --- a/nntp/browse.c +++ b/nntp/browse.c @@ -56,7 +56,7 @@ const char *group_index_format_str(char *buf, size_t buflen, size_t col, int col const char *if_str, const char *else_str, unsigned long data, int flags) { - char fn[SHORT_STRING], fmt[SHORT_STRING]; + char fn[128], fmt[128]; struct Folder *folder = (struct Folder *) data; switch (op) diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 73266f420..bac81b49e 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -924,7 +924,7 @@ const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char struct NntpAccountData *adata = (struct NntpAccountData *) data; struct ConnAccount *acct = &adata->conn->account; struct Url url; - char fn[SHORT_STRING], fmt[SHORT_STRING], *p = NULL; + char fn[128], fmt[128], *p = NULL; switch (op) { diff --git a/pager.c b/pager.c index c5a5b5bba..ed5248efe 100644 --- a/pager.c +++ b/pager.c @@ -2230,8 +2230,8 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e { static char searchbuf[STRING] = ""; char buffer[LONG_STRING]; - char helpstr[SHORT_STRING * 2]; - char tmphelp[SHORT_STRING * 2]; + char helpstr[256]; + char tmphelp[256]; int ch = 0, rc = -1; bool first = true; int searchctx = 0; diff --git a/pop/pop.c b/pop/pop.c index 185c44d07..ef4e893fd 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -89,7 +89,7 @@ bool C_PopLast; ///< Config: (pop) Use the 'LAST' command to fetch new mail */ static const char *cache_id(const char *id) { - static char clean[SHORT_STRING]; + static char clean[128]; mutt_str_strfcpy(clean, id, sizeof(clean)); mutt_file_sanitize_filename(clean, true); return clean; @@ -588,7 +588,7 @@ void pop_fetch_mail(void) } char buffer[LONG_STRING]; - char msgbuf[SHORT_STRING]; + char msgbuf[128]; int delanswer, last = 0, msgs, bytes, rset = 0, ret; struct ConnAccount acct; diff --git a/progress.c b/progress.c index 9dfe9f088..8ea6b5eba 100644 --- a/progress.c +++ b/progress.c @@ -169,7 +169,7 @@ void mutt_progress_init(struct Progress *progress, const char *msg, */ void mutt_progress_update(struct Progress *progress, long pos, int percent) { - char posstr[SHORT_STRING]; + char posstr[128]; bool update = false; struct timeval tv = { 0, 0 }; unsigned int now = 0; diff --git a/progress.h b/progress.h index 8e02fc61e..39377ce41 100644 --- a/progress.h +++ b/progress.h @@ -43,7 +43,7 @@ struct Progress long pos; size_t size; unsigned int timestamp; - char sizestr[SHORT_STRING]; + char sizestr[128]; }; void mutt_progress_init(struct Progress *progress, const char *msg, diff --git a/query.c b/query.c index 2d1def863..afdb8a6fe 100644 --- a/query.c +++ b/query.c @@ -251,7 +251,7 @@ static const char *query_format_str(char *buf, size_t buflen, size_t col, int co { struct Entry *entry = (struct Entry *) data; struct Query *query = entry->data; - char fmt[SHORT_STRING]; + char fmt[128]; char tmp[STRING] = ""; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/recvattach.c b/recvattach.c index 1ac849a65..81a319b54 100644 --- a/recvattach.c +++ b/recvattach.c @@ -209,8 +209,8 @@ const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, ch const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; - char charset[SHORT_STRING]; + char fmt[128]; + char charset[128]; struct AttachPtr *aptr = (struct AttachPtr *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); size_t l; @@ -256,7 +256,7 @@ const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, ch if (mutt_is_message_type(aptr->content->type, aptr->content->subtype) && C_MessageFormat && aptr->content->email) { - char s[SHORT_STRING]; + char s[128]; mutt_make_string_flags(s, sizeof(s), C_MessageFormat, NULL, NULL, aptr->content->email, MUTT_FORMAT_FORCESUBJ | MUTT_FORMAT_ARROWCURSOR); @@ -376,7 +376,7 @@ const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, ch if (!optional) { - char tmp[SHORT_STRING]; + char tmp[128]; mutt_str_pretty_size(tmp, sizeof(tmp), l); mutt_format_s(buf, buflen, prec, tmp); } @@ -787,7 +787,7 @@ void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter) { struct State state = { 0 }; - char buf[SHORT_STRING]; + char buf[128]; if (fp) filter = false; /* sanity check: we can't filter in the recv case yet */ @@ -935,7 +935,7 @@ static void print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, */ void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top) { - char prompt[SHORT_STRING]; + char prompt[128]; struct State state = { 0 }; int tagmsgcount = 0; diff --git a/recvcmd.c b/recvcmd.c index 6cbb70ba8..e3d010966 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -400,7 +400,7 @@ static struct AttachPtr *find_parent(struct AttachCtx *actx, struct Body *cur, s static void include_header(bool quote, FILE *ifp, struct Email *e, FILE *ofp, char *prefix) { int chflags = CH_DECODE; - char prefix2[SHORT_STRING]; + char prefix2[128]; if (C_Weed) chflags |= CH_WEED | CH_REORDER; @@ -916,7 +916,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, char tmpbody[PATH_MAX]; FILE *tmpfp = NULL; - char prefix[SHORT_STRING]; + char prefix[128]; #ifdef USE_NNTP if (flags & SEND_NEWS) diff --git a/remailer.c b/remailer.c index 4e1e98c2c..592b75b24 100644 --- a/remailer.c +++ b/remailer.c @@ -437,7 +437,7 @@ static const char *mix_format_str(char *buf, size_t buflen, size_t col, int cols const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING]; + char fmt[128]; struct Remailer *remailer = (struct Remailer *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/rfc1524.c b/rfc1524.c index fd460c8eb..2702e2c26 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -457,7 +457,7 @@ int rfc1524_mailcap_lookup(struct Body *a, char *type, return 0; } - mutt_check_lookup_list(a, type, SHORT_STRING); + mutt_check_lookup_list(a, type, 128); while (!found && *curr) { diff --git a/sendlib.c b/sendlib.c index 34d8ea0cf..6d982fce9 100644 --- a/sendlib.c +++ b/sendlib.c @@ -503,7 +503,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) mutt_error(_("No boundary parameter found [report this error]")); return -1; } - char boundary[SHORT_STRING]; + char boundary[128]; mutt_str_strfcpy(boundary, p, sizeof(boundary)); for (struct Body *t = a->parts; t; t = t->next) @@ -537,7 +537,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) if (a->type == TYPE_TEXT && (!a->noconv)) { - char send_charset[SHORT_STRING]; + char send_charset[128]; fc = mutt_ch_fgetconv_open( fpin, a->charset, mutt_body_get_charset(a, send_charset, sizeof(send_charset)), 0); } @@ -1340,7 +1340,7 @@ static void set_encoding(struct Body *b, struct Content *info) { if (b->type == TYPE_TEXT) { - char send_charset[SHORT_STRING]; + char send_charset[128]; char *chsname = mutt_body_get_charset(b, send_charset, sizeof(send_charset)); if ((info->lobin && !mutt_str_startswith(chsname, "iso-2022", CASE_IGNORE)) || info->linemax > 990 || (info->from && C_EncodeFrom)) @@ -2466,7 +2466,7 @@ const char *mutt_fqdn(bool may_hide_host) */ static char *gen_msgid(void) { - char buf[SHORT_STRING]; + char buf[128]; time_t now; unsigned char rndid[MUTT_RANDTAG_LEN + 1]; @@ -2967,7 +2967,7 @@ static int bounce_message(FILE *fp, struct Email *e, struct Address *to, FILE *f = mutt_file_fopen(tempfile, "w"); if (f) { - char date[SHORT_STRING]; + char date[128]; int chflags = CH_XMIT | CH_NONEWLINE | CH_NOQFROM; if (!C_BounceDelivered) @@ -3151,7 +3151,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, int rc = -1; bool need_mailbox_cleanup = false; struct stat st; - char buf[SHORT_STRING]; + char buf[128]; int onm_flags; if (post) diff --git a/sort.c b/sort.c index 36c888f02..bfaec559e 100644 --- a/sort.c +++ b/sort.c @@ -174,11 +174,11 @@ static int compare_to(const void *a, const void *b) { struct Email **ppa = (struct Email **) a; struct Email **ppb = (struct Email **) b; - char fa[SHORT_STRING]; + char fa[128]; - mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->to), SHORT_STRING); + mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->to), sizeof(fa)); const char *fb = mutt_get_name((*ppb)->env->to); - int result = mutt_str_strncasecmp(fa, fb, SHORT_STRING); + int result = mutt_str_strncasecmp(fa, fb, sizeof(fa)); result = perform_auxsort(result, a, b); return SORTCODE(result); } @@ -190,11 +190,11 @@ static int compare_from(const void *a, const void *b) { struct Email **ppa = (struct Email **) a; struct Email **ppb = (struct Email **) b; - char fa[SHORT_STRING]; + char fa[128]; - mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->from), SHORT_STRING); + mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->from), sizeof(fa)); const char *fb = mutt_get_name((*ppb)->env->from); - int result = mutt_str_strncasecmp(fa, fb, SHORT_STRING); + int result = mutt_str_strncasecmp(fa, fb, sizeof(fa)); result = perform_auxsort(result, a, b); return SORTCODE(result); } diff --git a/status.c b/status.c index b4604d98f..440c3a604 100644 --- a/status.c +++ b/status.c @@ -92,7 +92,7 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c const char *if_str, const char *else_str, unsigned long data, int flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp = NULL; + char fmt[128], tmp[128], *cp = NULL; int count, optional = (flags & MUTT_FORMAT_OPTIONAL); struct Menu *menu = (struct Menu *) data; -- 2.40.0