diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2017-06-08 12:43:48 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-06-15 18:00:14 +0200 |
commit | 4b0d5e081a263050732e652a77c308dd90c44372 (patch) | |
tree | 40793d08f4555254cc8a0bc01a59768f143c3f76 /lib/xfrm | |
parent | 429efd4ebaeebf32ad594f79a3e125ab5257a458 (diff) | |
download | libnl-4b0d5e081a263050732e652a77c308dd90c44372.tar.gz |
lib/xfrm/ae.c: fix memcpy(dst, dst) bug
This is clearly not what was intended. While at it, drop the pointless
cast of the allocator's return value, and use plain malloc since we're
explicitly populating all len bytes immediately afterwards.
Diffstat (limited to 'lib/xfrm')
-rw-r--r-- | lib/xfrm/ae.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xfrm/ae.c b/lib/xfrm/ae.c index 8e82c9ad..011a6e52 100644 --- a/lib/xfrm/ae.c +++ b/lib/xfrm/ae.c @@ -174,9 +174,9 @@ static int xfrm_ae_clone(struct nl_object *_dst, struct nl_object *_src) if (src->replay_state_esn) { uint32_t len = sizeof (struct xfrmnl_replay_state_esn) + (sizeof (uint32_t) * src->replay_state_esn->bmp_len); - if ((dst->replay_state_esn = (struct xfrmnl_replay_state_esn*)calloc (1, len)) == NULL) + if ((dst->replay_state_esn = malloc (len)) == NULL) return -NLE_NOMEM; - memcpy (dst->replay_state_esn, dst->replay_state_esn, len); + memcpy (dst->replay_state_esn, src->replay_state_esn, len); } return 0; |