The memory belonging to tx_buf and rx_buf in ynl_sock is not initialized after allocation. This commit ensures the entire allocated memory is set to zero. When asan is enabled, uninitialized bytes may contain poison values. This can cause failures e.g. when doing ynl_attr_put_str then poisoned bytes appear after the null terminator. As a result, tc filter addition may fail. Signed-off-by: Zahari Doychev --- tools/net/ynl/lib/ynl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c index 2bcd781111d7..16a4815d6a49 100644 --- a/tools/net/ynl/lib/ynl.c +++ b/tools/net/ynl/lib/ynl.c @@ -744,7 +744,7 @@ ynl_sock_create(const struct ynl_family *yf, struct ynl_error *yse) ys = malloc(sizeof(*ys) + 2 * YNL_SOCKET_BUFFER_SIZE); if (!ys) return NULL; - memset(ys, 0, sizeof(*ys)); + memset(ys, 0, sizeof(*ys) + 2 * YNL_SOCKET_BUFFER_SIZE); ys->family = yf; ys->tx_buf = &ys->raw_buf[0]; -- 2.51.0