mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 17:06:39 +09:00
path-util: introduce path_is_safe()
The function is similar to path_is_valid(), but it refuses paths which contain ".." component.
This commit is contained in:
@@ -155,7 +155,13 @@ int path_extract_filename(const char *p, char **ret);
|
||||
int path_extract_directory(const char *p, char **ret);
|
||||
|
||||
bool filename_is_valid(const char *p) _pure_;
|
||||
bool path_is_valid(const char *p) _pure_;
|
||||
bool path_is_valid_full(const char *p, bool accept_dot_dot) _pure_;
|
||||
static inline bool path_is_valid(const char *p) {
|
||||
return path_is_valid_full(p, true);
|
||||
}
|
||||
static inline bool path_is_safe(const char *p) {
|
||||
return path_is_valid_full(p, false);
|
||||
}
|
||||
bool path_is_normalized(const char *p) _pure_;
|
||||
|
||||
char *file_in_same_dir(const char *path, const char *filename);
|
||||
|
||||
Reference in New Issue
Block a user