diff options
| author | Scott Larson <[email protected]> | 2021-01-07 18:16:40 -0800 |
|---|---|---|
| committer | Scott Larson <[email protected]> | 2021-01-07 18:16:40 -0800 |
| commit | 699d64dc5e4ef6cedd42401bc10cf9f3be0b476b (patch) | |
| tree | d0e31ccb944f81f30b83184b49f19dd337cc5adc /common | |
| parent | f66451ca193a96b5734e9a99d6d0ed9de44c9ac5 (diff) | |
update to v6.1.3
Diffstat (limited to 'common')
| -rw-r--r-- | common/inc/nx_api.h | 12 | ||||
| -rw-r--r-- | common/src/nx_ipv6_process_hop_by_hop_option.c | 13 | ||||
| -rw-r--r-- | common/src/nx_utility.c | 90 |
3 files changed, 112 insertions, 3 deletions
diff --git a/common/inc/nx_api.h b/common/inc/nx_api.h index cd56b4eb..a48e15b4 100644 --- a/common/inc/nx_api.h +++ b/common/inc/nx_api.h @@ -26,7 +26,7 @@ /* APPLICATION INTERFACE DEFINITION RELEASE */ /* */ /* nx_api.h PORTABLE C */ -/* 6.1.2 */ +/* 6.1.3 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ @@ -52,6 +52,12 @@ /* 11-09-2020 Yuxin Zhou Modified comment(s), and */ /* updated product constants, */ /* resulting in version 6.1.2 */ +/* 12-31-2020 Yuxin Zhou Modified comment(s), added */ +/* PTP timestamp capability, */ +/* added function to convert */ +/* string to unsigned integer, */ +/* updated product constants, */ +/* resulting in version 6.1.3 */ /* */ /**************************************************************************/ @@ -459,7 +465,7 @@ VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG #define AZURE_RTOS_NETXDUO #define NETXDUO_MAJOR_VERSION 6 #define NETXDUO_MINOR_VERSION 1 -#define NETXDUO_PATCH_VERSION 2 +#define NETXDUO_PATCH_VERSION 3 /* Define the following symbols for backward compatibility */ #define EL_PRODUCT_NETXDUO @@ -1301,6 +1307,7 @@ typedef struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT #define NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM 0x00000200 #define NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM 0x00000400 #define NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM 0x00000800 +#define NX_INTERFACE_CAPABILITY_PTP_TIMESTAMP 0x00001000 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */ #define NX_IP_VERSION_V4 0x4 @@ -3803,6 +3810,7 @@ VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index); /* Utility functions. */ UINT _nx_utility_string_length_check(CHAR *input_string, UINT *string_length, UINT max_string_length); +UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number); /* Determine if a C++ compiler is being used. If so, complete the standard C conditional started above. */ diff --git a/common/src/nx_ipv6_process_hop_by_hop_option.c b/common/src/nx_ipv6_process_hop_by_hop_option.c index cef14f7b..c5881662 100644 --- a/common/src/nx_ipv6_process_hop_by_hop_option.c +++ b/common/src/nx_ipv6_process_hop_by_hop_option.c @@ -38,7 +38,7 @@ /* FUNCTION RELEASE */ /* */ /* _nx_ipv6_process_hop_by_hop_option PORTABLE C */ -/* 6.1 */ +/* 6.1.3 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ @@ -73,6 +73,9 @@ /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ /* 09-30-2020 Yuxin Zhou Modified comment(s), */ /* resulting in version 6.1 */ +/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */ +/* buffer read overflow check, */ +/* resulting in version 6.1.3 */ /* */ /**************************************************************************/ UINT _nx_ipv6_process_hop_by_hop_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr) @@ -87,6 +90,14 @@ NX_IPV6_HOP_BY_HOP_OPTION *option; /* Add debug information. */ NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); + /* Make sure there's no OOB when reading Hdr Ext Len from the packet buffer. */ + if ((UINT)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr) < 2) + { + + /* return an error code. */ + return(NX_OPTION_HEADER_ERROR); + } + /* Read the Hdr Ext Len field. */ header_length = *(packet_ptr -> nx_packet_prepend_ptr + 1); diff --git a/common/src/nx_utility.c b/common/src/nx_utility.c index eb2aac31..60e750b7 100644 --- a/common/src/nx_utility.c +++ b/common/src/nx_utility.c @@ -107,3 +107,93 @@ UINT i; return(NX_SUCCESS); } +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_utility_string_to_uint PORTABLE C */ +/* 6.1.3 */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function converts the string to unsigned integer. */ +/* */ +/* INPUT */ +/* */ +/* input_string Pointer to input string */ +/* string_length Length of input string */ +/* number Pointer to the number */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */ +/* */ +/**************************************************************************/ +UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number) +{ + +UINT i; + + + /* Check for invalid input pointers. */ + if ((input_string == NX_NULL) || (number == NX_NULL)) + { + return(NX_PTR_ERROR); + } + + /* Check string length. */ + if (string_length == 0) + { + return(NX_SIZE_ERROR); + } + + /* Initialize. */ + i = 0; + *number = 0; + + /* Traverse the string. */ + while (i < string_length) + { + + /* Is a numeric character present? */ + if ((input_string[i] >= '0') && (input_string[i] <= '9')) + { + + /* Check overflow. Max Value: Hex:0xFFFFFFFF, Decimal: 4294967295. */ + if (((*number == 429496729) && (input_string[i] > '5')) || + (*number >= 429496730)) + { + return(NX_OVERFLOW); + } + + /* Yes, numeric character is present. Update the number. */ + *number = (*number * 10) + (UINT) (input_string[i] - '0'); + } + else + { + return(NX_INVALID_PARAMETERS); + } + + i++; + } + + /* Return success. */ + return(NX_SUCCESS); +} |
