iptables: fix regression with unintended free in need_protomatch
[project/firewall3.git] / includes.c
index 86392109cae6c70c767c63e40a543bf7507ac3e0..d1e574c19586a93018842406a4277769ad10f5e4 100644 (file)
@@ -140,7 +140,7 @@ print_include(struct fw3_include *include)
        }
 
        while (fgets(line, sizeof(line), f))
-               fw3_pr(line);
+               fw3_pr("%s", line);
 
        fclose(f);
 }
@@ -182,19 +182,14 @@ fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload)
                fw3_command_close();
 }
 
+#define TEMPLATE "config() { echo \"You cannot use UCI in firewall includes!\" >&2; exit 1; }; . %s"
 
 static void
 run_include(struct fw3_include *include)
 {
        int rv;
        struct stat s;
-       const char *tmpl =
-               "config() { "
-                       "echo \"You cannot use UCI in firewall includes!\" >&2; "
-                       "exit 1; "
-               "}; . %s";
-
-       char buf[PATH_MAX + sizeof(tmpl)];
+       char buf[PATH_MAX + sizeof(TEMPLATE)];
 
        info(" * Running script '%s'", include->path);
 
@@ -204,7 +199,7 @@ run_include(struct fw3_include *include)
                return;
        }
 
-       snprintf(buf, sizeof(buf), tmpl, include->path);
+       snprintf(buf, sizeof(buf), TEMPLATE, include->path);
        rv = system(buf);
 
        if (rv)