chase: put limit on overall chase cycles
Let's add some protections in case we deal with inodes owned by an untrusted person, with concurrent access: let's put a limit on how long we traverse, and fail eventually so that live changes cannot send us in circles indefinitely. This reworks the current CHASE_MAX logic so that it not only applies to symlinks transitions, but to any transitions. This also bumps CHASE_MAX a bit, given that it's now bumped on every single iteration of the loop.
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ typedef enum ChaseFlags {
|
||||
bool unsafe_transition(const struct stat *a, const struct stat *b);
|
||||
|
||||
/* How many iterations to execute before returning -ELOOP */
|
||||
#define CHASE_MAX 32
|
||||
#define CHASE_MAX 128U
|
||||
|
||||
int chase(const char *path_with_prefix, const char *root, ChaseFlags flags, char **ret_path, int *ret_fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user