@@ -321,6 +321,28 @@ int main(int argc, char **argv)
}
}
+ /* Check for unsafe library and header paths */
+ for (i = 1; i < argc; i++) {
+ const struct str_len_s *opt;
+ for (opt=unsafe_opts; opt->str; opt++ ) {
+ /* Skip any non-unsafe option. */
+ if (strncmp(argv[i], opt->str, opt->len))
+ continue;
+
+ /* Handle both cases:
+ * - path is a separate argument,
+ * - path is concatenated with option.
+ */
+ if (argv[i][opt->len] == '\0') {
+ i++;
+ if (i == argc)
+ break;
+ check_unsafe_path(argv[i-1], argv[i], 0);
+ } else
+ check_unsafe_path(argv[i], argv[i] + opt->len, 1);
+ }
+ }
+
#ifdef BR_CCACHE
ret = snprintf(ccache_path, sizeof(ccache_path), "%s/bin/ccache", absbasedir);
if (ret >= sizeof(ccache_path)) {
@@ -474,28 +496,6 @@ int main(int argc, char **argv)
#endif
}
- /* Check for unsafe library and header paths */
- for (i = 1; i < argc; i++) {
- const struct str_len_s *opt;
- for (opt=unsafe_opts; opt->str; opt++ ) {
- /* Skip any non-unsafe option. */
- if (strncmp(argv[i], opt->str, opt->len))
- continue;
-
- /* Handle both cases:
- * - path is a separate argument,
- * - path is concatenated with option.
- */
- if (argv[i][opt->len] == '\0') {
- i++;
- if (i == argc)
- break;
- check_unsafe_path(argv[i-1], argv[i], 0);
- } else
- check_unsafe_path(argv[i], argv[i] + opt->len, 1);
- }
- }
-
/* append forward args */
memcpy(cur, &argv[1], sizeof(char *) * (argc - 1));
cur += argc - 1;