From 0f8443653dc210b7a982971105eaf380105043e3 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 24 May 2021 08:30:26 -0300 Subject: [PATCH] ospf6d: fix address sanitizer crash Don't `memcpy` a `struct prefix` the memory size varies depending on the original intended type. In this case the original type was (casted away) `struct prefix_ipv6` and we tried to copy `struct prefix` which is bigger. Signed-off-by: Rafael Zalamena --- ospf6d/ospf6_asbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 96dcdba68f..245e5dcd3d 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1282,7 +1282,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, /* create new entry */ route = ospf6_route_create(); route->type = OSPF6_DEST_TYPE_NETWORK; - memcpy(&route->prefix, prefix, sizeof(struct prefix)); + prefix_copy(&route->prefix, prefix); info = (struct ospf6_external_info *)XCALLOC( MTYPE_OSPF6_EXTERNAL_INFO, sizeof(struct ospf6_external_info)); -- 2.39.5