From 1e26abb343d520acabe3110ab1df09710cf029bc Mon Sep 17 00:00:00 2001 From: Mateusz Majewski Date: Fri, 12 Nov 2021 14:05:01 +0100 Subject: [PATCH] Fix fdi_logger_wrap ASAN issue The wrapped function -- as the name suggests -- is supposed to open the file, but also returns its path. The tests used to only return the path conditionally, but the tested function checks the path length, which might fail if the path is left uninitialized. The solution is to write the path to the buffer unconditionally. Change-Id: Iffe4e323c258834fe7f63f2d719ce3c12fd7c60a --- src/tests/fdi_logger_wrap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/fdi_logger_wrap.c b/src/tests/fdi_logger_wrap.c index e4951b7..253f48e 100644 --- a/src/tests/fdi_logger_wrap.c +++ b/src/tests/fdi_logger_wrap.c @@ -31,6 +31,8 @@ int __wrap_logger_open_buffer_from_config_get_path(int buf_id, const struct log_ if (open_buf_path) strncpy(actual_path, open_buf_path, path_size); + else + actual_path[0] = '\0'; if (open_buf_ret > 0) *fd = 0xFD; return open_buf_ret; -- 2.7.4