summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/export-to-sqlite.py
diff options
context:
space:
mode:
authorAzeem Shaikh <azeems@google.com>2023-09-19 19:21:56 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-03 14:36:09 +0200
commit95e8e7eebab58ec8f6c978242a6d143ba238a69e (patch)
tree54f82ca331524ef9a3109209f4044c464f1bf34c /tools/perf/scripts/python/export-to-sqlite.py
parent29bff582b74ed0bdb7e6986482ad9e6799ea4d2f (diff)
vt: Replace strlcpy with strscpy
strlcpy() reads the entire source buffer first and returns the size of the source string, not the destination string, which can be accidentally misused [1]. The copy_to_user() call uses @len returned from strlcpy() directly without checking its value. This could potentially lead to read overflow. There is no existing bug since @len is always guaranteed to be greater than hardcoded strings in @func_table[kb_func]. But as written it is very fragile and specifically uses a strlcpy() result without sanity checking and using it to copy to userspace. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] https://github.com/KSPP/linux/issues/89 Signed-off-by: Azeem Shaikh <azeems@google.com> Reviewed-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230919192156.121503-1-azeems@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions