- /* only try to parse if we can format it as header for
- * mutt_parse_rfc822_line (tag fits in scratch) */
- snprintf (scratch, sizeof (scratch), "%s: %s", tag, value);
- scratch[taglen] = '\0';
- value = &scratch[taglen+1];
+ char *scratch;
+ size_t taglen = mutt_strlen (tag);
+
+ safe_asprintf (&scratch, "%s: %s", tag, value);
+ scratch[taglen] = 0; /* overwrite the colon as mutt_parse_rfc822_line expects */
+ value = &scratch[taglen + 1];