condition: rework condvar name check

Use memchr() instead of a for loop to detect '/' in the condvar name.
Also unconditionally disallow names starting with a dot.
This commit is contained in:
Jan Engelhardt
2008-04-02 05:00:33 +02:00
parent 586353342f
commit c9579115c3
2 changed files with 9 additions and 18 deletions

View File

@@ -31,8 +31,8 @@ static int condition_parse(int c, char **argv, int invert, unsigned int *flags,
check_inverse(optarg, &invert, &optind, 0);
if (strlen(argv[optind - 1]) < CONDITION_NAME_LEN)
strcpy(info->name, argv[optind - 1]);
if (strlen(optarg) < sizeof(info->name))
strcpy(info->name, optarg);
else
exit_error(PARAMETER_PROBLEM,
"File name too long");