]> granicus.if.org Git - neomutt/commitdiff
Convert last rfc1524_expand_command caller to use a Buffer
authorKevin McCarthy <kevin@8t8.us>
Sun, 14 Apr 2019 18:38:49 +0000 (11:38 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 24 Jun 2019 13:26:30 +0000 (14:26 +0100)
rfc1524.c

index 17e2d2fec68b24aa0723d5a064e20d90dcd475a5..e6d934632cad13b675c7ba5308b38cf40446f91b 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -358,18 +358,16 @@ static bool rfc1524_mailcap_parse(struct Body *a, char *filename, char *type,
 
           if (get_field_text(field + plen, &test_command, type, filename, line) && test_command)
           {
-            const size_t len = mutt_str_strlen(test_command) + 256;
-            mutt_mem_realloc(&test_command, len);
-            if (rfc1524_expand_command(a, a->filename, type, test_command, len) == 1)
-            {
-              mutt_debug(LL_DEBUG1, "Command is expecting to be piped\n");
-            }
-            if (mutt_system(test_command) != 0)
+            struct Buffer *command = mutt_buffer_pool_get();
+            mutt_buffer_strcpy(command, test_command);
+            mutt_buffer_rfc1524_expand_command(a, a->filename, type, command);
+            if (mutt_system(mutt_b2s(command)))
             {
               /* a non-zero exit code means test failed */
               found = false;
             }
             FREE(&test_command);
+            mutt_buffer_pool_release(&command);
           }
         }
         else if (mutt_str_startswith(field, "x-neomutt-keep", CASE_IGNORE))