diff --git a/contrib/dlz/drivers/dlz_filesystem_driver.c b/contrib/dlz/drivers/dlz_filesystem_driver.c index 97186e4433..a136e65028 100644 --- a/contrib/dlz/drivers/dlz_filesystem_driver.c +++ b/contrib/dlz/drivers/dlz_filesystem_driver.c @@ -113,10 +113,10 @@ is_safe(const char *input) { if (i == 0) return (false); /* '..', two dots together is not allowed. */ - else if (input[i-1] == '.') + if (input[i-1] == '.') return (false); /* '.' is not allowed as last char */ - if (i == len) + if (i == len - 1) return (false); /* only 1 dot in ok location, continue at next char */ continue; diff --git a/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c b/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c index 4ff2b31f24..494bd1805a 100644 --- a/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c +++ b/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c @@ -106,10 +106,10 @@ is_safe(const char *input) { if (i == 0) return (false); /* '..', two dots together is not allowed. */ - else if (input[i-1] == '.') + if (input[i-1] == '.') return (false); /* '.' is not allowed as last char */ - if (i == len) + if (i == len - 1) return (false); /* only 1 dot in ok location, continue at next char */ continue;