Skip to content

Commit 55b1458

Browse files
Merge branch 'main' into dev-stm32
2 parents b1d730b + 4f67761 commit 55b1458

File tree

43 files changed

+539
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+539
-145
lines changed

.github/.cSpellWords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ BLXNS
8989
bmcr
9090
BMSR
9191
BPDG
92+
BPIALL
9293
brgintclr
9394
brginten
9495
brgintstat

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# the repo. Unless a later match takes precedence,
55
# @global-owner1 and @global-owner2 will be requested for
66
# review when someone opens a pull request.
7-
* @FreeRTOS/pr-bar-raiser
7+
* @FreeRTOS/pr-bar-raisers
88

99
# Order is important; the last matching pattern takes the most
1010
# precedence. When someone opens a pull request that only

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ jobs:
408408
- name: Set up CBMC runner
409409
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
410410
with:
411-
cbmc_version: "5.95.1"
411+
cbmc_version: "6.3.1"
412412

413413
- env:
414414
stepName: Install Dependencies

source/FreeRTOS_DHCP.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
/**
8282
* @brief The number of end-points that are making use of the UDP-socket.
8383
*/
84-
static BaseType_t xDHCPSocketUserCount = 0;
84+
_static BaseType_t xDHCPSocketUserCount = 0;
8585

8686
/*
8787
* Generate a DHCP discover message and send it on the DHCP socket.
@@ -881,7 +881,7 @@
881881
configASSERT( xSocketValid( xDHCPv4Socket ) == pdTRUE );
882882

883883
/* MISRA Ref 11.4.1 [Socket error and integer to pointer conversion] */
884-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
884+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
885885
/* coverity[misra_c_2012_rule_11_4_violation] */
886886
if( xSocketValid( xDHCPv4Socket ) == pdTRUE )
887887
{

source/FreeRTOS_DHCPv6.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@
8585
( ( ( uint32_t ) 1U ) << DHCPv6_Option_Server_Identifier ) )
8686

8787
/** @brief The UDP socket which is shared by all end-points that need DHCPv6. */
88-
static Socket_t xDHCPv6Socket;
88+
_static Socket_t xDHCPv6Socket;
8989

9090
/** @brief A reference count makes sure that the UDP socket will be deleted when it
9191
* is not used anymore. */
92-
static BaseType_t xDHCPv6SocketUserCount;
92+
_static BaseType_t xDHCPv6SocketUserCount;
9393

9494
static BaseType_t prvIsOptionLengthValid( uint16_t usOption,
9595
size_t uxOptionLength,
@@ -151,7 +151,7 @@ static BaseType_t prvDHCPv6_handleOption( struct xNetworkEndPoint * pxEndPoint,
151151
/**
152152
* @brief DHCP IPv6 message object
153153
*/
154-
static DHCPMessage_IPv6_t xDHCPMessage;
154+
_static DHCPMessage_IPv6_t xDHCPMessage;
155155

156156
/**
157157
* @brief Get the DHCP state from a given endpoint.
@@ -1500,7 +1500,13 @@ static BaseType_t prvDHCPv6Analyse( struct xNetworkEndPoint * pxEndPoint,
15001500
}
15011501
else
15021502
{
1503-
ulOptionsReceived |= ( ( ( uint32_t ) 1U ) << usOption );
1503+
/* ulOptionsReceived has only 32-bits, it's not allowed to shift more than 32-bits on it. */
1504+
if( usOption < 32 )
1505+
{
1506+
/* Store the option by bit-map only if it's less than 32. */
1507+
ulOptionsReceived |= ( ( ( uint32_t ) 1U ) << usOption );
1508+
}
1509+
15041510
xReady = prvDHCPv6_handleOption( pxEndPoint, usOption, &( xSet ), pxDHCPMessage, &( xMessage ) );
15051511
}
15061512

source/FreeRTOS_DNS.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ const MACAddress_t xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB
257257

258258
/* 'xFamily' might not be used when IPv6 is disabled. */
259259
( void ) xFamily;
260+
/* 'pcName' might not be used when DNS cache is disabled. */
261+
( void ) pcName;
262+
260263
pvBuffer = pvPortMalloc( sizeof( *pxAddrInfo ) );
261264

262265
if( pvBuffer != NULL )

source/FreeRTOS_DNS_Parser.c

Lines changed: 92 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
#if ( ipconfigUSE_DNS != 0 )
4949

50+
#if ( ( ipconfigUSE_DNS_CACHE != 0 ) || ( ipconfigDNS_USE_CALLBACKS != 0 ) || ( ipconfigUSE_MDNS != 0 ) || ( ipconfigUSE_LLMNR != 0 ) )
5051

5152
/**
5253
* @brief Read the Name field out of a DNS response packet.
@@ -56,110 +57,111 @@
5657
*
5758
* @return If a fully formed name was found, then return the number of bytes processed in pucByte.
5859
*/
59-
size_t DNS_ReadNameField( ParseSet_t * pxSet,
60-
size_t uxDestLen )
61-
{
62-
size_t uxNameLen = 0U;
63-
size_t uxIndex = 0U;
64-
size_t uxSourceLen = pxSet->uxSourceBytesRemaining;
65-
const uint8_t * pucByte = pxSet->pucByte;
66-
67-
/* uxCount gets the values from pucByte and counts down to 0.
68-
* No need to have a different type than that of pucByte */
69-
size_t uxCount;
70-
71-
if( uxSourceLen == ( size_t ) 0U )
60+
size_t DNS_ReadNameField( ParseSet_t * pxSet,
61+
size_t uxDestLen )
7262
{
73-
/* Return 0 value in case of error. */
74-
uxIndex = 0U;
75-
}
63+
size_t uxNameLen = 0U;
64+
size_t uxIndex = 0U;
65+
size_t uxSourceLen = pxSet->uxSourceBytesRemaining;
66+
const uint8_t * pucByte = pxSet->pucByte;
7667

77-
/* Determine if the name is the fully coded name, or an offset to the name
78-
* elsewhere in the message. */
79-
else if( ( pucByte[ uxIndex ] & dnsNAME_IS_OFFSET ) == dnsNAME_IS_OFFSET )
80-
{
81-
/* Jump over the two byte offset. */
82-
if( uxSourceLen > sizeof( uint16_t ) )
83-
{
84-
uxIndex += sizeof( uint16_t );
85-
}
86-
else
68+
/* uxCount gets the values from pucByte and counts down to 0.
69+
* No need to have a different type than that of pucByte */
70+
size_t uxCount;
71+
72+
if( uxSourceLen == ( size_t ) 0U )
8773
{
74+
/* Return 0 value in case of error. */
8875
uxIndex = 0U;
8976
}
90-
}
91-
else
92-
{
93-
/* 'uxIndex' points to the full name. Walk over the string. */
94-
while( ( uxIndex < uxSourceLen ) && ( pucByte[ uxIndex ] != ( uint8_t ) 0x00U ) )
95-
{
96-
/* If this is not the first time through the loop, then add a
97-
* separator in the output. */
98-
if( ( uxNameLen > 0U ) )
99-
{
100-
/*
101-
* uxNameLen can never be greater than uxDestLen, since there are checks
102-
* outside this condition, so the check is removed.
103-
*/
104-
pxSet->pcName[ uxNameLen ] = '.';
105-
uxNameLen++;
106-
}
107-
108-
/* Process the first/next sub-string. */
109-
uxCount = ( size_t ) pucByte[ uxIndex ];
11077

111-
/* uxIndex should point to the first character now, unless uxCount
112-
* is an offset field. */
113-
uxIndex++;
114-
115-
if( ( uxIndex + uxCount ) > uxSourceLen )
78+
/* Determine if the name is the fully coded name, or an offset to the name
79+
* elsewhere in the message. */
80+
else if( ( pucByte[ uxIndex ] & dnsNAME_IS_OFFSET ) == dnsNAME_IS_OFFSET )
81+
{
82+
/* Jump over the two byte offset. */
83+
if( uxSourceLen > sizeof( uint16_t ) )
11684
{
117-
uxIndex = 0U;
118-
break;
85+
uxIndex += sizeof( uint16_t );
11986
}
120-
121-
if( ( uxNameLen + uxCount ) >= uxDestLen )
87+
else
12288
{
12389
uxIndex = 0U;
124-
break;
125-
}
126-
127-
while( uxCount-- != 0U )
128-
{
129-
/*
130-
* uxNameLen can never be greater than uxDestLen, since there are checks
131-
* outside this condition, so the check is removed.
132-
*/
133-
pxSet->pcName[ uxNameLen ] = ( char ) pucByte[ uxIndex ];
134-
uxNameLen++;
135-
uxIndex++;
13690
}
13791
}
138-
139-
/* Confirm that a fully formed name was found. */
140-
if( uxIndex > 0U )
92+
else
14193
{
142-
/* Here, there is no need to check for pucByte[ uxindex ] == 0 because:
143-
* When we break out of the above while loop, uxIndex is made 0 thereby
144-
* failing above check. Whenever we exit the loop otherwise, either
145-
* pucByte[ uxIndex ] == 0 (which makes the check here unnecessary) or
146-
* uxIndex >= uxSourceLen (which makes sure that we do not go in the 'if'
147-
* case).
148-
*/
149-
if( uxIndex < uxSourceLen )
94+
/* 'uxIndex' points to the full name. Walk over the string. */
95+
while( ( uxIndex < uxSourceLen ) && ( pucByte[ uxIndex ] != ( uint8_t ) 0x00U ) )
15096
{
151-
pxSet->pcName[ uxNameLen ] = '\0';
97+
/* If this is not the first time through the loop, then add a
98+
* separator in the output. */
99+
if( ( uxNameLen > 0U ) )
100+
{
101+
/*
102+
* uxNameLen can never be greater than uxDestLen, since there are checks
103+
* outside this condition, so the check is removed.
104+
*/
105+
pxSet->pcName[ uxNameLen ] = '.';
106+
uxNameLen++;
107+
}
108+
109+
/* Process the first/next sub-string. */
110+
uxCount = ( size_t ) pucByte[ uxIndex ];
111+
112+
/* uxIndex should point to the first character now, unless uxCount
113+
* is an offset field. */
152114
uxIndex++;
115+
116+
if( ( uxIndex + uxCount ) > uxSourceLen )
117+
{
118+
uxIndex = 0U;
119+
break;
120+
}
121+
122+
if( ( uxNameLen + uxCount ) >= uxDestLen )
123+
{
124+
uxIndex = 0U;
125+
break;
126+
}
127+
128+
while( uxCount-- != 0U )
129+
{
130+
/*
131+
* uxNameLen can never be greater than uxDestLen, since there are checks
132+
* outside this condition, so the check is removed.
133+
*/
134+
pxSet->pcName[ uxNameLen ] = ( char ) pucByte[ uxIndex ];
135+
uxNameLen++;
136+
uxIndex++;
137+
}
153138
}
154-
else
139+
140+
/* Confirm that a fully formed name was found. */
141+
if( uxIndex > 0U )
155142
{
156-
uxIndex = 0U;
143+
/* Here, there is no need to check for pucByte[ uxindex ] == 0 because:
144+
* When we break out of the above while loop, uxIndex is made 0 thereby
145+
* failing above check. Whenever we exit the loop otherwise, either
146+
* pucByte[ uxIndex ] == 0 (which makes the check here unnecessary) or
147+
* uxIndex >= uxSourceLen (which makes sure that we do not go in the 'if'
148+
* case).
149+
*/
150+
if( uxIndex < uxSourceLen )
151+
{
152+
pxSet->pcName[ uxNameLen ] = '\0';
153+
uxIndex++;
154+
}
155+
else
156+
{
157+
uxIndex = 0U;
158+
}
157159
}
158160
}
159-
}
160161

161-
return uxIndex;
162-
}
162+
return uxIndex;
163+
}
164+
#endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS || ipconfigUSE_MDNS || ipconfigUSE_LLMNR */
163165

164166
/**
165167
* @brief Simple routine that jumps over the NAME field of a resource record.
@@ -285,7 +287,7 @@
285287
* for easier access. */
286288

287289
/* MISRA Ref 11.3.1 [Misaligned access] */
288-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
290+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
289291
/* coverity[misra_c_2012_rule_11_3_violation] */
290292
xSet.pxDNSMessageHeader = ( ( DNSMessage_t * )
291293
pucUDPPayloadBuffer );
@@ -355,15 +357,15 @@
355357
}
356358
#endif
357359

358-
#if ( ipconfigUSE_DNS_CACHE == 1 ) || ( ipconfigDNS_USE_CALLBACKS == 1 )
360+
#if ( ( ipconfigUSE_DNS_CACHE != 0 ) || ( ipconfigDNS_USE_CALLBACKS != 0 ) || ( ipconfigUSE_MDNS != 0 ) || ( ipconfigUSE_LLMNR != 0 ) )
359361
if( x == 0U )
360362
{
361363
uxResult = DNS_ReadNameField( &xSet,
362364
sizeof( xSet.pcName ) );
363365
( void ) uxResult;
364366
}
365367
else
366-
#endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS */
368+
#endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS || ipconfigUSE_MDNS || ipconfigUSE_LLMNR */
367369
{
368370
/* Skip the variable length pcName field. */
369371
uxResult = DNS_SkipNameField( xSet.pucByte,
@@ -721,7 +723,7 @@
721723
* fields of the structure. */
722724

723725
/* MISRA Ref 11.3.1 [Misaligned access] */
724-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
726+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
725727
/* coverity[misra_c_2012_rule_11_3_violation] */
726728
pxDNSAnswerRecord = ( ( DNSAnswerRecord_t * ) pxSet->pucByte );
727729

@@ -874,7 +876,7 @@
874876
/* Cast the response to DNSAnswerRecord for easy access to fields of the DNS response. */
875877

876878
/* MISRA Ref 11.3.1 [Misaligned access] */
877-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
879+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
878880
/* coverity[misra_c_2012_rule_11_3_violation] */
879881
pxDNSAnswerRecord = ( ( DNSAnswerRecord_t * ) pxSet->pucByte );
880882

@@ -1093,7 +1095,7 @@
10931095
/* Define the ASCII value of the capital "A". */
10941096
const uint8_t ucCharA = ( uint8_t ) 0x41U;
10951097

1096-
ucByte = ( uint8_t ) ( ( ( pucSource[ 0 ] - ucCharA ) << 4 ) |
1098+
ucByte = ( uint8_t ) ( ( ( ( pucSource[ 0 ] - ucCharA ) & 0x0F ) << 4 ) |
10971099
( pucSource[ 1 ] - ucCharA ) );
10981100

10991101
/* Make sure there are no trailing spaces in the name. */

0 commit comments

Comments
 (0)