Skip to content

Commit

Permalink
BUG/MINOR: cfgparse-global: fix allowed args number for setenv
Browse files Browse the repository at this point in the history
Keywords setenv and presetenv take 2 arguments: variable name and value.
So, the total number, that should be passed to alertif_too_many_args is 2
("setenv <name> <value>") instead of 3. For alertif_too_many_args the first
argument index is 0.

This should be backported in all stable versions.

(cherry picked from commit df68f7e)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit d53d6fb)
Signed-off-by: Christopher Faulet <[email protected]>
(cherry picked from commit 60ba2dc)
Signed-off-by: Christopher Faulet <[email protected]>
  • Loading branch information
vkssv authored and capflam committed Oct 1, 2024
1 parent fe6cac1 commit f77d9f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cfgparse-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
#endif /* ! USE_CPU_AFFINITY */
}
else if (strcmp(args[0], "setenv") == 0 || strcmp(args[0], "presetenv") == 0) {
if (alertif_too_many_args(3, file, linenum, args, &err_code))
if (alertif_too_many_args(2, file, linenum, args, &err_code))
goto out;

if (*(args[2]) == 0) {
Expand Down

0 comments on commit f77d9f7

Please sign in to comment.