From: Arran Cudbard-Bell Date: Thu, 25 May 2017 19:51:46 +0000 (-0400) Subject: PVS studio won't know about talloc_array_length... and it's more efficient too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b25fa2284fd71d253cf3ff355a5596b43116c509;p=thirdparty%2Ffreeradius-server.git PVS studio won't know about talloc_array_length... and it's more efficient too --- diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c index 78a49b196ae..3a37bd09d07 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -93,7 +93,7 @@ static int eapmschapv2_compose(rlm_eap_mschapv2_t const *inst, eap_session_t *ea * | Server Name... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - length = MSCHAPV2_HEADER_LEN + MSCHAPV2_CHALLENGE_LEN + strlen(inst->identity); + length = MSCHAPV2_HEADER_LEN + MSCHAPV2_CHALLENGE_LEN + (talloc_array_length(inst->identity) - 1); eap_round->request->type.data = talloc_array(eap_round->request, uint8_t, length); /* @@ -118,7 +118,7 @@ static int eapmschapv2_compose(rlm_eap_mschapv2_t const *inst, eap_session_t *ea */ memcpy(ptr, reply->vp_octets, reply->vp_length); - memcpy((ptr + reply->vp_length), inst->identity, strlen(inst->identity)); + memcpy((ptr + reply->vp_length), inst->identity, (talloc_array_length(inst->identity) - 1)); break; case FR_MSCHAP2_SUCCESS: