summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-11-27 21:22:07 +0100
committerThomas Haller <thaller@redhat.com>2023-11-29 16:03:40 +0100
commit9c97deff90b7c0bf2d0c7006bffc2a95cc4fbfa6 (patch)
tree5d20fc4766ef40663a0678a3d99e945ff9999cf4
parent8b6dc8348b0388d4525c77345e00e180b0483278 (diff)
downloadlibnl-9c97deff90b7c0bf2d0c7006bffc2a95cc4fbfa6.tar.gz
xfrm: fix parsing address in xfrmnl_ae_parse()
Passing a size of (sizeof (ae_id->saddr)) is wrong for IPv4. The size depends on the address family. Fixes: 917154470895 ('xfrm: add xfrm support')
-rw-r--r--lib/xfrm/ae.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xfrm/ae.c b/lib/xfrm/ae.c
index 4f56690e..716e4e65 100644
--- a/lib/xfrm/ae.c
+++ b/lib/xfrm/ae.c
@@ -133,6 +133,7 @@
#include "nl-priv-dynamic-core/object-api.h"
#include "nl-priv-dynamic-core/nl-core.h"
#include "nl-priv-dynamic-core/cache-api.h"
+#include "nl-aux-core/nl-core.h"
/** @cond SKIP */
@@ -540,11 +541,11 @@ int xfrmnl_ae_parse(struct nlmsghdr *n, struct xfrmnl_ae **result)
if (err < 0)
goto errout;
- ae->sa_id.daddr = nl_addr_build(ae_id->sa_id.family, &ae_id->sa_id.daddr, sizeof (ae_id->sa_id.daddr));
+ ae->sa_id.daddr = _nl_addr_build(ae_id->sa_id.family, &ae_id->sa_id.daddr);
ae->sa_id.family= ae_id->sa_id.family;
ae->sa_id.spi = ntohl(ae_id->sa_id.spi);
ae->sa_id.proto = ae_id->sa_id.proto;
- ae->saddr = nl_addr_build(ae_id->sa_id.family, &ae_id->saddr, sizeof (ae_id->saddr));
+ ae->saddr = _nl_addr_build(ae_id->sa_id.family, &ae_id->saddr);
ae->reqid = ae_id->reqid;
ae->flags = ae_id->flags;
ae->ce_mask |= (XFRM_AE_ATTR_DADDR | XFRM_AE_ATTR_FAMILY | XFRM_AE_ATTR_SPI |