]> gitweb.michael.orlitzky.com - apply-default-acl.git/commitdiff
src/libadacl.c: use strncat instead of strcat to appease clang-tidy.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 24 Jun 2018 22:25:56 +0000 (18:25 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 24 Jun 2018 22:25:56 +0000 (18:25 -0400)
src/libadacl.c

index d2462c816f49420aaa2a09aff1fe2c2144f466ef..4ca60c0c0d972018486bc725c17752725a07ebeb 100644 (file)
@@ -1020,7 +1020,9 @@ int apply_default_acl(const char* path, bool recursive) {
   bool path_is_dots = strcmp(child, ".") == 0 || strcmp(child, "..") == 0;
   char dots_parent[6] = "../";
   if (path_is_dots) {
-    parent = strcat(dots_parent, child);
+    /* We know that "child" contains no more than two characters here, and
+       using strncat to enforce that belief keeps clang-tidy happy. */
+    parent = strncat(dots_parent, child, 2);
   }
 
   parent_fd = safe_open(parent, O_DIRECTORY | O_NOFOLLOW);