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);