eapol/eapol_framework/eapol_common/core/eap_process_tlv_message_data.cpp
changeset 49 43351a4f2da3
parent 34 ad1f037f1ac2
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 42 %
    19 * %version: 45 %
    20 */
    20 */
    21 
    21 
    22 // This is enumeration of EAPOL source code.
    22 // This is enumeration of EAPOL source code.
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    24 	#undef EAP_FILE_NUMBER_ENUM
    24 	#undef EAP_FILE_NUMBER_ENUM
  1326 }
  1326 }
  1327 
  1327 
  1328 //--------------------------------------------------
  1328 //--------------------------------------------------
  1329 
  1329 
  1330 EAP_FUNC_EXPORT eap_status_e eap_process_tlv_message_data_c::add_parameter_data(
  1330 EAP_FUNC_EXPORT eap_status_e eap_process_tlv_message_data_c::add_parameter_data(
  1331 	const eap_general_header_base_c * const packet_data)
  1331 	const eap_general_header_base_c * const packet_data,
       
  1332 	const u32_t packet_length)
  1332 {
  1333 {
  1333 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1334 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1334 
  1335 
  1335 	EAP_TRACE_DEBUG(
  1336 	EAP_TRACE_DEBUG(
  1336 		m_am_tools,
  1337 		m_am_tools,
  1344 	{
  1345 	{
  1345 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1346 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1346 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  1347 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  1347 	}
  1348 	}
  1348 
  1349 
       
  1350 	if (packet_length > packet_data->get_header_buffer_length())
       
  1351 	{
       
  1352 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1353 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1354 	}
       
  1355 
  1349 	eap_status_e status = add_message_data(
  1356 	eap_status_e status = add_message_data(
  1350 		eap_tlv_message_type_variable_data,
  1357 		eap_tlv_message_type_variable_data,
  1351 		packet_data->get_header_buffer_length(),
  1358 		packet_length,
  1352 		packet_data->get_header_buffer(packet_data->get_header_buffer_length()));
  1359 		packet_data->get_header_buffer(packet_length));
  1353 
  1360 
  1354 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1361 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1355 	return EAP_STATUS_RETURN(m_am_tools, status);
  1362 	return EAP_STATUS_RETURN(m_am_tools, status);
  1356 }
  1363 }
  1357 
  1364