Skip to content
Permalink
Browse files

Terminate buffers in opendir.c correctly

  • Loading branch information
arr2036 committed Aug 3, 2019
1 parent c852dea commit aaae66007732a451199f11a8329b400fbbd89dfe
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/modules/rlm_mschap/opendir.c
@@ -138,14 +138,16 @@ static rlm_rcode_t getUserNodeRef(REQUEST *request, char* inUserName, char **out
if (strcmp(pAttrEntry->fAttributeSignature.fBufferData, kDSNAttrMetaNodeLocation) == 0) {
status = dsGetAttributeValue(nodeRef, tDataBuff, 1, valueRef, &pValueEntry);
if (status == eDSNoErr && pValueEntry != NULL) {
pUserLocation = talloc_zero_array(request, char, pValueEntry->fAttributeValueData.fBufferLength + 1);
pUserLocation = talloc_array(request, char, pValueEntry->fAttributeValueData.fBufferLength + 1);
memcpy(pUserLocation, pValueEntry->fAttributeValueData.fBufferData, pValueEntry->fAttributeValueData.fBufferLength);
pUserLocation[pValueEntry->fAttributeValueData.fBufferLength] = '\0';
}
} else if (strcmp(pAttrEntry->fAttributeSignature.fBufferData, kDSNAttrRecordName) == 0) {
status = dsGetAttributeValue(nodeRef, tDataBuff, 1, valueRef, &pValueEntry);
if (status == eDSNoErr && pValueEntry != NULL) {
*outUserName = talloc_array(request, char, pValueEntry->fAttributeValueData.fBufferLength + 1);
memcpy(*outUserName, pValueEntry->fAttributeValueData.fBufferData, pValueEntry->fAttributeValueData.fBufferLength);
*outUserName[pValueEntry->fAttributeValueData.fBufferLength] = '\0';
}
}

0 comments on commit aaae660

Please sign in to comment.
You can’t perform that action at this time.