mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+17 -17
+7 -7
attach.c
··· 58 58 entry = rfc1524_new_entry(); 59 59 60 60 snprintf(type, sizeof(type), "%s/%s", TYPE(a), a->subtype); 61 - rfc1524_mailcap_lookup(a, type, entry, 0); 61 + rfc1524_mailcap_lookup(a, type, sizeof(type), entry, 0); 62 62 mutt_rfc1524_expand_filename (entry->nametemplate, a->filename, tempfile); 63 63 64 64 rfc1524_free_entry(&entry); ··· 103 103 int rc = 0; 104 104 105 105 snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); 106 - if (rfc1524_mailcap_lookup (a, type, entry, MUTT_COMPOSE)) 106 + if (rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_COMPOSE)) 107 107 { 108 108 if (entry->composecommand || entry->composetypecommand) 109 109 { ··· 239 239 int rc = 0; 240 240 241 241 snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); 242 - if (rfc1524_mailcap_lookup (a, type, entry, MUTT_EDIT)) 242 + if (rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_EDIT)) 243 243 { 244 244 if (entry->editcommand) 245 245 { ··· 303 303 } 304 304 305 305 306 - void mutt_check_lookup_list (BODY *b, char *type, int len) 306 + void mutt_check_lookup_list (BODY *b, char *type, size_t len) 307 307 { 308 308 LIST *t = MimeLookupList; 309 309 int i; ··· 374 374 if (use_mailcap) 375 375 { 376 376 entry = rfc1524_new_entry (); 377 - if (!rfc1524_mailcap_lookup (a, type, entry, 0)) 377 + if (!rfc1524_mailcap_lookup (a, type, sizeof(type), entry, 0)) 378 378 { 379 379 if (flag == MUTT_REGULAR) 380 380 { ··· 929 929 930 930 snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); 931 931 932 - if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT)) 932 + if (rfc1524_mailcap_lookup (a, type, sizeof(type), NULL, MUTT_PRINT)) 933 933 { 934 934 rfc1524_entry *entry = NULL; 935 935 int piped = FALSE; ··· 937 937 dprint (2, (debugfile, "Using mailcap...\n")); 938 938 939 939 entry = rfc1524_new_entry (); 940 - rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT); 940 + rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_PRINT); 941 941 mutt_rfc1524_expand_filename (entry->nametemplate, a->filename, 942 942 newfile); 943 943
+3 -3
handler.c
··· 955 955 */ 956 956 static int mutt_is_autoview (BODY *b) 957 957 { 958 - char type[SHORT_STRING]; 958 + char type[STRING]; 959 959 int is_autoview = 0; 960 960 961 961 snprintf (type, sizeof (type), "%s/%s", TYPE (b), b->subtype); ··· 988 988 * 989 989 * WARNING: type is altered by this call as a result of `mime_lookup' support */ 990 990 if (is_autoview) 991 - return rfc1524_mailcap_lookup(b, type, NULL, MUTT_AUTOVIEW); 991 + return rfc1524_mailcap_lookup(b, type, sizeof(type), NULL, MUTT_AUTOVIEW); 992 992 993 993 return 0; 994 994 } ··· 1320 1320 tempfile = mutt_buffer_pool_get (); 1321 1321 1322 1322 snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); 1323 - rfc1524_mailcap_lookup (a, type, entry, MUTT_AUTOVIEW); 1323 + rfc1524_mailcap_lookup (a, type, sizeof(type), entry, MUTT_AUTOVIEW); 1324 1324 1325 1325 fname = safe_strdup (a->filename); 1326 1326 mutt_sanitize_filename (fname, 1);
+1 -1
protos.h
··· 236 236 void mutt_help (int); 237 237 const char *mutt_idxfmt_hook (const char *, CONTEXT *, HEADER *); 238 238 void mutt_draw_tree (CONTEXT *); 239 - void mutt_check_lookup_list (BODY *, char *, int); 239 + void mutt_check_lookup_list (BODY *, char *, size_t); 240 240 void mutt_make_attribution (CONTEXT *ctx, HEADER *cur, FILE *out); 241 241 void mutt_make_forward_subject (ENVELOPE *env, CONTEXT *ctx, HEADER *cur); 242 242 void mutt_make_help (char *, size_t, const char *, int, int);
+3 -2
recvattach.c
··· 741 741 snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype); 742 742 if (!tag || top->tagged) 743 743 { 744 - if (!rfc1524_mailcap_lookup (top, type, NULL, MUTT_PRINT)) 744 + if (!rfc1524_mailcap_lookup (top, type, sizeof(type), NULL, MUTT_PRINT)) 745 745 { 746 746 if (ascii_strcasecmp ("text/plain", top->subtype) && 747 747 ascii_strcasecmp ("application/postscript", top->subtype)) ··· 775 775 if (!tag || top->tagged) 776 776 { 777 777 snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype); 778 - if (!option (OPTATTACHSPLIT) && !rfc1524_mailcap_lookup (top, type, NULL, MUTT_PRINT)) 778 + if (!option (OPTATTACHSPLIT) && 779 + !rfc1524_mailcap_lookup (top, type, sizeof(type), NULL, MUTT_PRINT)) 779 780 { 780 781 if (!ascii_strcasecmp ("text/plain", top->subtype) || 781 782 !ascii_strcasecmp ("application/postscript", top->subtype))
+2 -3
rfc1524.c
··· 420 420 * in *entry, and returns 1. On failure (not found), returns 0. 421 421 * If entry == NULL just return 1 if the given type is found. 422 422 */ 423 - int rfc1524_mailcap_lookup (BODY *a, char *type, rfc1524_entry *entry, int opt) 423 + int rfc1524_mailcap_lookup (BODY *a, char *type, size_t typelen, rfc1524_entry *entry, int opt) 424 424 { 425 425 BUFFER *path = NULL; 426 426 int found = FALSE; ··· 438 438 return 0; 439 439 } 440 440 441 - /* FIXME: sizeof type should be passed to rfc1524_mailcap_lookup() */ 442 - mutt_check_lookup_list (a, type, SHORT_STRING); 441 + mutt_check_lookup_list (a, type, typelen); 443 442 444 443 path = mutt_buffer_pool_get (); 445 444
+1 -1
rfc1524.h
··· 38 38 void rfc1524_free_entry (rfc1524_entry **); 39 39 int mutt_rfc1524_expand_command (BODY *, const char *, const char *, BUFFER *); 40 40 void mutt_rfc1524_expand_filename (const char *, const char *, BUFFER *); 41 - int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int); 41 + int rfc1524_mailcap_lookup (BODY *, char *, size_t, rfc1524_entry *, int); 42 42 int mutt_rename_file (const char *, const char *); 43 43 44 44 #endif /* _RFC1524_H */