diff options
Diffstat (limited to 'src/fnetfilter')
-rw-r--r-- | src/fnetfilter/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fnetfilter/main.c b/src/fnetfilter/main.c index ba58ba3c9..34ebf5926 100644 --- a/src/fnetfilter/main.c +++ b/src/fnetfilter/main.c | |||
@@ -79,13 +79,17 @@ static void process_template(char *src, const char *dest) { | |||
79 | *arg_start = '\0'; | 79 | *arg_start = '\0'; |
80 | arg_start++; | 80 | arg_start++; |
81 | if (*arg_start == '\0') { | 81 | if (*arg_start == '\0') { |
82 | fprintf(stderr, "Error fnetfilter: you need to provide at least on argument\n"); | 82 | fprintf(stderr, "Error fnetfilter: you need to provide at least one argument\n"); |
83 | exit(1); | 83 | exit(1); |
84 | } | 84 | } |
85 | 85 | ||
86 | // extract the arguments from command line | 86 | // extract the arguments from command line |
87 | char *token = strtok(arg_start, ","); | 87 | char *token = strtok(arg_start, ","); |
88 | while (token) { | 88 | while (token) { |
89 | if (argcnt == MAXARGS) { | ||
90 | fprintf(stderr, "Error fnetfilter: only up to %u arguments are supported\n", (unsigned) MAXARGS); | ||
91 | exit(1); | ||
92 | } | ||
89 | // look for abnormal things | 93 | // look for abnormal things |
90 | int len = strlen(token); | 94 | int len = strlen(token); |
91 | if (strcspn(token, "\\&!?\"'<>%^(){};,*[]") != (size_t)len) { | 95 | if (strcspn(token, "\\&!?\"'<>%^(){};,*[]") != (size_t)len) { |
@@ -125,7 +129,7 @@ for (i = 0; i < argcnt; i++) | |||
125 | else { | 129 | else { |
126 | // parsing | 130 | // parsing |
127 | int index = 0; | 131 | int index = 0; |
128 | int rv = sscanf(ptr, "$ARG%u", &index) ; | 132 | int rv = sscanf(ptr, "$ARG%d", &index) ; |
129 | if (rv != 1) { | 133 | if (rv != 1) { |
130 | fprintf(stderr, "Error fnetfilter: invalid template argument on line %d\n", line); | 134 | fprintf(stderr, "Error fnetfilter: invalid template argument on line %d\n", line); |
131 | exit(1); | 135 | exit(1); |