lib: Link State memory corruption

In function ls_find_subnet(), prefix argument is directly copied into
subnet.key structure to find corresponding subnet in RB Tree. This could leadr
to a memory corruption. Function prefix_copy() must be used instead.

This patch replaces the direct prefix copy by a call to prefix_copy() function
to avoid this memory issue.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
This commit is contained in:
Olivier Dugeon 2023-04-21 18:09:28 +02:00
parent 0633fb7856
commit 871b46e7eb

View File

@ -947,7 +947,10 @@ struct ls_subnet *ls_find_subnet(struct ls_ted *ted,
{
struct ls_subnet subnet = {};
subnet.key = *prefix;
if (!prefix)
return NULL;
prefix_copy(&subnet.key, prefix);
return subnets_find(&ted->subnets, &subnet);
}