i=vitaly
i=rahul
We need to check the len before matching the string
to prevent something like net matches neterror
int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
int *oldmask, int minmask, int allmask)
{
int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
int *oldmask, int minmask, int allmask)
{
char op = 0;
int newmask = minmask, i, len, found = 0;
ENTRY;
char op = 0;
int newmask = minmask, i, len, found = 0;
ENTRY;
/* match token */
found = 0;
for (i = 0; i < 32; i++) {
/* match token */
found = 0;
for (i = 0; i < 32; i++) {
- if (cfs_strncasecmp(str, bit2str(i), len) == 0) {
+ debugstr = bit2str(i);
+ if (debugstr != NULL &&
+ strlen(debugstr) == len &&
+ cfs_strncasecmp(str, debugstr, len) == 0) {
if (op == '-')
newmask &= ~(1 << i);
else
if (op == '-')
newmask &= ~(1 << i);
else
- if (!found && (cfs_strncasecmp(str, "ALL", len) == 0)) {
+ if (!found && len == 3 &&
+ (cfs_strncasecmp(str, "ALL", len) == 0)) {
if (op == '-')
newmask = minmask;
else
if (op == '-')
newmask = minmask;
else