Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf: fix access violation in libbpf_print_fn.
libbpf_print_fn uses va_arg and explicit argument type "char*" to retrieve arguments as strings. This assumption is incorrect. In case when libbpf logs a printf format string with argument being a non-string type, the str pointer will point to memory that is not NULL terminated. Wnen strstr is called with a non-NULL terminated string, we hit access violation on the stack. This change uses a temporary string allocated on the stack to be filled with a printf formatted string with the arguments converted into the string. The keywords search are performed on the temporary string buffer. Signed-off-by: Hao Xiang <haoxiang@bytedance.com>
- Loading branch information