Parcourir la source

TNC: Fix TNC_{TNCC,TNCS}_ReportMessageTypes copy type

The supportedTypes parameter is a list of TNC_MessageType values
and the buffer to be copied should use size of TNC_MessageType, not
TNC_MessageTypeList. In practice, these are of same length on most
platforms, so this is not a critical issue, but anyway, the correct
type should be used.
Jouni Malinen il y a 14 ans
Parent
commit
f8b5f7dc6b
2 fichiers modifiés avec 4 ajouts et 4 suppressions
  1. 2 2
      src/eap_peer/tncc.c
  2. 2 2
      src/eap_server/tncs.c

+ 2 - 2
src/eap_peer/tncc.c

@@ -180,11 +180,11 @@ TNC_Result TNC_TNCC_ReportMessageTypes(
 	imc = tnc_imc[imcID];
 	os_free(imc->supported_types);
 	imc->supported_types =
-		os_malloc(typeCount * sizeof(TNC_MessageTypeList));
+		os_malloc(typeCount * sizeof(TNC_MessageType));
 	if (imc->supported_types == NULL)
 		return TNC_RESULT_FATAL;
 	os_memcpy(imc->supported_types, supportedTypes,
-		  typeCount * sizeof(TNC_MessageTypeList));
+		  typeCount * sizeof(TNC_MessageType));
 	imc->num_supported_types = typeCount;
 
 	return TNC_RESULT_SUCCESS;

+ 2 - 2
src/eap_server/tncs.c

@@ -234,11 +234,11 @@ TNC_Result TNC_TNCS_ReportMessageTypes(
 		return TNC_RESULT_INVALID_PARAMETER;
 	os_free(imv->supported_types);
 	imv->supported_types =
-		os_malloc(typeCount * sizeof(TNC_MessageTypeList));
+		os_malloc(typeCount * sizeof(TNC_MessageType));
 	if (imv->supported_types == NULL)
 		return TNC_RESULT_FATAL;
 	os_memcpy(imv->supported_types, supportedTypes,
-		  typeCount * sizeof(TNC_MessageTypeList));
+		  typeCount * sizeof(TNC_MessageType));
 	imv->num_supported_types = typeCount;
 
 	return TNC_RESULT_SUCCESS;