diff options
author | Kevin McCarthy <kevin@8t8.us> | 2019-10-23 19:17:09 +0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2019-10-23 19:17:09 +0800 |
commit | 12cd2d529c8462268c3958e4ae2bab25cee92ae7 (patch) | |
tree | ebb67c1032146102cb7411850bdf1b467162878a /attach.c | |
parent | 8997c55f48e356c28a9eadcc3fae224be5ffac02 (diff) |
Add typelen parameter to rfc1524_mailcap_lookup().
Because of mime_lookup commands, the call to mutt_check_lookup_list()
inside the function can modify the passed in type. Add an explicit
length parameter to the function, rather than assume the parameter
size. This also makes it more evident the type parameter can be
modified to callers.
Change the len parameter to mutt_check_lookup_list() to type size_t,
just to be correct about it.
Diffstat (limited to 'attach.c')
-rw-r--r-- | attach.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -58,7 +58,7 @@ int mutt_get_tmp_attachment (BODY *a) entry = rfc1524_new_entry(); snprintf(type, sizeof(type), "%s/%s", TYPE(a), a->subtype); - rfc1524_mailcap_lookup(a, type, entry, 0); + rfc1524_mailcap_lookup(a, type, sizeof(type), entry, 0); mutt_rfc1524_expand_filename (entry->nametemplate, a->filename, tempfile); rfc1524_free_entry(&entry); @@ -103,7 +103,7 @@ int mutt_compose_attachment (BODY *a) int rc = 0; snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, entry, MUTT_COMPOSE)) + if (rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_COMPOSE)) { if (entry->composecommand || entry->composetypecommand) { @@ -239,7 +239,7 @@ int mutt_edit_attachment (BODY *a) int rc = 0; snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, entry, MUTT_EDIT)) + if (rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_EDIT)) { if (entry->editcommand) { @@ -303,7 +303,7 @@ bailout: } -void mutt_check_lookup_list (BODY *b, char *type, int len) +void mutt_check_lookup_list (BODY *b, char *type, size_t len) { LIST *t = MimeLookupList; int i; @@ -374,7 +374,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, if (use_mailcap) { entry = rfc1524_new_entry (); - if (!rfc1524_mailcap_lookup (a, type, entry, 0)) + if (!rfc1524_mailcap_lookup (a, type, sizeof(type), entry, 0)) { if (flag == MUTT_REGULAR) { @@ -929,7 +929,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT)) + if (rfc1524_mailcap_lookup (a, type, sizeof(type), NULL, MUTT_PRINT)) { rfc1524_entry *entry = NULL; int piped = FALSE; @@ -937,7 +937,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) dprint (2, (debugfile, "Using mailcap...\n")); entry = rfc1524_new_entry (); - rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT); + rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_PRINT); mutt_rfc1524_expand_filename (entry->nametemplate, a->filename, newfile); |