}
if (!valid_attr)
{
- char *sep;
- char *attr_invalid = xstrdup (s);
+ char *attr_invalid = xmalloc ((p - s) + 1);
STACK_VAR (attr_invalid);
- if ((sep = strchr (attr_invalid, ',')))
- *sep = '\0';
+ strncpy (attr_invalid, s, p - s);
+ attr_invalid[p - s] = '\0';
vfprintf_fail ("--attr switch attribute '%s' is not valid", attr_invalid);
}
}
[ '--attr=:', 'must be provided a string' ],
[ '--attr=bold:underscore', 'must have strings separated by ,' ],
[ '--attr=b0ld', 'attribute \'b0ld\' is not valid' ],
- [ '--attr=b0ld,underscore', 'attribute \'b0ld\' is not valid' ], # NULify comma
+ [ '--attr=b0ld,underscore', 'attribute \'b0ld\' is not valid' ], # handle comma
[ '--attr=bold,bold', 'has attribute \'bold\' twice or more' ],
[ '--exclude-random=random', 'must be provided a plain color' ],
[ '--clean --clean-all', 'mutually exclusive' ],