]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
properly detect period as last character in filename
authorMark Andrews <marka@isc.org>
Mon, 18 Feb 2019 01:40:11 +0000 (12:40 +1100)
committerEvan Hunt <each@isc.org>
Tue, 5 Mar 2019 22:22:46 +0000 (14:22 -0800)
(cherry picked from commit c9dc59eb90144b9935a143353eb38d8eef937cc1)

contrib/dlz/drivers/dlz_filesystem_driver.c
contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c

index a8af12d983decdc0da3b541fe25559e0ce0111c8..879cb67098127f978cd11f654fdfdf4f97ccfa2d 100644 (file)
@@ -112,10 +112,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;
index d164f530c845b1643711bdb544cf3f0021540898..a147a21c4fee28be5570c354ab3ddb8cb9bbf145 100644 (file)
@@ -105,10 +105,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;