Right now, the core string escaping routines in the kernel (string_escape_mem() in lib/string_helpers.c), have a bunch of routines for dealing with special characters. There are a couple problems:
using one subset (e.g. ESCAPE_SPACE) won't escape '\', leading to possible parsing confusion
using a combination (e.g. ESCAPE_SPACE and ESCAPE_OCTAL) will mix escape methods that can lead to parsing confusions (e.g. "\0" for NUL looks like an unfinished octal escape "\020")
places in the kernel calling into string_escape_mem() may do so without escaping '\\' (e.g. see callers of seq_file_path())
Right now, the core string escaping routines in the kernel (
string_escape_mem()
inlib/string_helpers.c
), have a bunch of routines for dealing with special characters. There are a couple problems:ESCAPE_SPACE
) won't escape'\'
, leading to possible parsing confusionESCAPE_SPACE
andESCAPE_OCTAL
) will mix escape methods that can lead to parsing confusions (e.g."\0"
forNUL
looks like an unfinished octal escape"\020"
)string_escape_mem()
may do so without escaping'\\'
(e.g. see callers ofseq_file_path()
)