int length = i->vp_length;
int attrlen;
uint8_t const *p = &i->vp_octets[0];
- char *q;
VALUE_PAIR *sub;
/*
*/
sub = radius_pair_create(request->packet, &request->packet->vps,
PW_DIGEST_REALM - 1 + p[0], 0);
- sub->vp_length = attrlen - 2;
- sub->vp_strvalue = q = talloc_array(sub, char, sub->vp_length + 1);
- memcpy(q, p + 2, attrlen - 2);
- q[attrlen - 2] = '\0';
+ fr_pair_value_bstrncpy(sub, p + 2, attrlen - 2);
if ((rad_debug_lvl > 1) && fr_log_fp) {
vp_print(fr_log_fp, sub);
*/
} else if (eap_ds->response->type.length <= 128) {
int rcode;
- char *p;
/*
* If there was a User-Password in the request,
if (!vp) {
return 0;
}
- vp->vp_length = eap_ds->response->type.length;
- vp->vp_strvalue = p = talloc_array(vp, char, vp->vp_length + 1);
- vp->type = VT_DATA;
- memcpy(p, eap_ds->response->type.data, vp->vp_length);
- p[vp->vp_length] = 0;
+
+ fr_pair_value_bstrncpy(vp, eap_ds->response->type.data, eap_ds->response->type.length);
/*
* Add the password to the request, and allow