mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
string_helpers: add kstrdup_quotable_file
Allocate a NULL-terminated file path with special characters escaped, safe for logging. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.l.morris@oracle.com>
This commit is contained in:
parent
0d0443288f
commit
21985319ad
2 changed files with 33 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct file;
|
||||
|
||||
/* Descriptions of the types of units to
|
||||
* print in */
|
||||
enum string_size_units {
|
||||
|
@ -70,5 +72,6 @@ static inline int string_escape_str_any_np(const char *src, char *dst,
|
|||
|
||||
char *kstrdup_quotable(const char *src, gfp_t gfp);
|
||||
char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);
|
||||
char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue