Fix fdi_logger_wrap ASAN issue 95/266495/2 accepted/tizen/unified/20211116.130446 submit/tizen/20211115.105406
authorMateusz Majewski <m.majewski2@samsung.com>
Fri, 12 Nov 2021 13:05:01 +0000 (14:05 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Fri, 12 Nov 2021 14:07:33 +0000 (15:07 +0100)
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

index e4951b7..253f48e 100644 (file)
@@ -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;