logging: fix TOCTTOU issue in z_log_hexdump_from_user
Previously, a racing write to the provided metadata could result
in up to CONFIG_LOG_STRDUP_MAX_STRING-2 bytes after the
end of user-accessible memory being leaked into the strdup pool
or the resulting log.
For now, explicitly copy the metadata string. In an ideal world
this could directly copy from userspace into the strdup buffer, but
this obviously only works if strdup is enabled.
Signed-off-by: James Harris <james.harris@intel.com>
1 file changed