From: Mark Andrews Date: Mon, 18 Feb 2019 01:40:11 +0000 (+1100) Subject: properly detect period as last character in filename X-Git-Tag: v9.14.0rc2~10^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b12970046a80b96aebb400ad810b6a9e8cd15d8d;p=thirdparty%2Fbind9.git properly detect period as last character in filename (cherry picked from commit c9dc59eb90144b9935a143353eb38d8eef937cc1) --- diff --git a/contrib/dlz/drivers/dlz_filesystem_driver.c b/contrib/dlz/drivers/dlz_filesystem_driver.c index 97186e44335..a136e650287 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 4ff2b31f248..494bd1805a0 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;