aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server/eap_server_ikev2.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-03-07 09:17:23 (GMT)
committerJouni Malinen <j@w1.fi>2017-03-07 11:19:10 (GMT)
commita1f11e34c4d6a10bdfef58cdba0b19e1335e087b (patch)
treef3ff7d078578a4b4a7ccf20058e65f1ddb96c622 /src/eap_server/eap_server_ikev2.c
parentdbdda355d0add3f7d96e3279321d3a63abfc4b32 (diff)
downloadhostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.zip
hostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.tar.gz
hostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.tar.bz2
Use os_memdup()
This leads to cleaner code overall, and also reduces the size of the hostapd and wpa_supplicant binaries (in hwsim test build on x86_64) by about 2.5 and 3.5KiB respectively. The mechanical conversions all over the code were done with the following spatch: @@ expression SIZE, SRC; expression a; @@ -a = os_malloc(SIZE); +a = os_memdup(SRC, SIZE); <... if (!a) {...} ...> -os_memcpy(a, SRC, SIZE); Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/eap_server/eap_server_ikev2.c')
-rw-r--r--src/eap_server/eap_server_ikev2.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/eap_server/eap_server_ikev2.c b/src/eap_server/eap_server_ikev2.c
index 3a249d1..1833419 100644
--- a/src/eap_server/eap_server_ikev2.c
+++ b/src/eap_server/eap_server_ikev2.c
@@ -103,10 +103,9 @@ static void * eap_ikev2_init(struct eap_sm *sm)
data->ikev2.proposal.encr = ENCR_AES_CBC;
data->ikev2.proposal.dh = DH_GROUP2_1024BIT_MODP;
- data->ikev2.IDi = os_malloc(sm->server_id_len);
+ data->ikev2.IDi = os_memdup(sm->server_id, sm->server_id_len);
if (data->ikev2.IDi == NULL)
goto failed;
- os_memcpy(data->ikev2.IDi, sm->server_id, sm->server_id_len);
data->ikev2.IDi_len = sm->server_id_len;
data->ikev2.get_shared_secret = eap_ikev2_get_shared_secret;