Limiting maximum command line arguments by CONFIG_JERRY_MAX_COMMAND_LINE_ARGS configuration option.

This commit is contained in:
Ruben Ayrapetyan
2014-12-17 21:28:27 +03:00
parent dd3271e35d
commit 001f262590
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -154,4 +154,9 @@
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
#endif /* CONFIG_ECMA_COMPACT_PROFILE */
/**
* Maximum number of arguments in the engine's command line (i.e. maximum argc value)
*/
#define CONFIG_JERRY_MAX_COMMAND_LINE_ARGS 64
#endif /* !CONFIG_H */
+6 -1
View File
@@ -138,7 +138,12 @@ int
main (int argc __unused,
char **argv __unused)
{
const char *file_names[argc];
if (argc > CONFIG_JERRY_MAX_COMMAND_LINE_ARGS)
{
jerry_exit (ERR_OUT_OF_MEMORY);
}
const char *file_names[CONFIG_JERRY_MAX_COMMAND_LINE_ARGS];
bool parse_only = false, show_opcodes = false;
bool print_mem_stats = false;
int i;