Skip to content

Commit bd5d12e

Browse files
authored
Merge pull request #302 from eclipse-threadx/dev
Release version 6.4.2
2 parents 6c8e9d1 + 4c39197 commit bd5d12e

File tree

18 files changed

+129
-39
lines changed

18 files changed

+129
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ compile_commands.json
1414
CTestTestfile.cmake
1515
.run.sh
1616

17+
scripts/openssl*

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22

33
# Set up the project
44
project(netxduo

addons/web/nx_web_http_server.c

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,8 +3968,8 @@ UINT temp_realm_length = 0;
39683968
}
39693969

39703970
/* Send response back to HTTP Client. */
3971-
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_INTERNAL_ERROR,
3972-
sizeof(NX_WEB_HTTP_STATUS_INTERNAL_ERROR) - 1,
3971+
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_BAD_REQUEST,
3972+
sizeof(NX_WEB_HTTP_STATUS_BAD_REQUEST) - 1,
39733973
"NetX HTTP Receive Timeout",
39743974
sizeof("NetX HTTP Receive Timeout") - 1, NX_NULL, 0);
39753975

@@ -4215,6 +4215,7 @@ VOID _nx_web_http_server_put_process(NX_WEB_HTTP_SERVER *server_ptr, NX_PACKET
42154215

42164216
UINT status;
42174217
ULONG length = 0;
4218+
ULONG consumed_length = 0;
42184219
UINT offset;
42194220
CHAR *name_ptr;
42204221
CHAR *password_ptr;
@@ -4447,8 +4448,7 @@ UINT temp_realm_length = 0;
44474448
nx_packet_release(packet_ptr);
44484449
}
44494450

4450-
/* Error, return to caller. */
4451-
return;
4451+
goto put_process_end;
44524452
}
44534453

44544454
/* Open the specified file for writing. */
@@ -4470,8 +4470,7 @@ UINT temp_realm_length = 0;
44704470
nx_packet_release(packet_ptr);
44714471
}
44724472

4473-
/* Error, return to caller. */
4474-
return;
4473+
goto put_process_end;
44754474
}
44764475

44774476
/* Determine if there is any content in the first packet. */
@@ -4498,12 +4497,28 @@ UINT temp_realm_length = 0;
44984497
nx_packet_release(packet_ptr);
44994498
}
45004499

4501-
/* Error, return to caller. */
4502-
return;
4500+
goto put_process_end;
45034501
}
45044502

45054503
/* Update the length. */
4506-
length = length - ((ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr) - offset);
4504+
consumed_length = ((ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr) - offset);
4505+
if ((length - consumed_length) > length)
4506+
{
4507+
/* Underflow error has occurred.*/
4508+
4509+
/* Send response back to HTTP Client. */
4510+
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_BAD_REQUEST,
4511+
sizeof(NX_WEB_HTTP_STATUS_BAD_REQUEST) - 1,
4512+
"NetX HTTP Content Length",
4513+
sizeof("NetX HTTP Content Length") - 1, NX_NULL, 0);
4514+
4515+
/* Release the previous data packet. */
4516+
nx_packet_release(data_packet_ptr);
4517+
4518+
status = NX_UNDERFLOW;
4519+
goto put_process_end;
4520+
}
4521+
length -= consumed_length;
45074522

45084523
/* Increment the bytes received count. */
45094524
server_ptr -> nx_web_http_server_total_bytes_received = server_ptr -> nx_web_http_server_total_bytes_received +
@@ -4536,12 +4551,28 @@ UINT temp_realm_length = 0;
45364551
nx_packet_release(packet_ptr);
45374552
}
45384553

4539-
/* Error, return to caller. */
4540-
return;
4554+
goto put_process_end;
45414555
}
45424556

45434557
/* Update the length. */
4544-
length = length - (ULONG)(next_packet_ptr -> nx_packet_append_ptr - next_packet_ptr -> nx_packet_prepend_ptr);
4558+
consumed_length = (ULONG)(next_packet_ptr -> nx_packet_append_ptr - next_packet_ptr -> nx_packet_prepend_ptr);
4559+
if ((length - consumed_length) > length)
4560+
{
4561+
/* Underflow error has occurred.*/
4562+
4563+
/* Send response back to HTTP Client. */
4564+
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_BAD_REQUEST,
4565+
sizeof(NX_WEB_HTTP_STATUS_BAD_REQUEST) - 1,
4566+
"NetX HTTP Content Length",
4567+
sizeof("NetX HTTP Content Length") - 1, NX_NULL, 0);
4568+
4569+
/* Release the previous data packet. */
4570+
nx_packet_release(data_packet_ptr);
4571+
4572+
status = NX_UNDERFLOW;
4573+
goto put_process_end;
4574+
}
4575+
length -= consumed_length;
45454576

45464577
/* Increment the bytes received count. */
45474578
server_ptr -> nx_web_http_server_total_bytes_received = server_ptr -> nx_web_http_server_total_bytes_received +
@@ -4575,13 +4606,12 @@ UINT temp_realm_length = 0;
45754606
}
45764607

45774608
/* Send response back to HTTP Client. */
4578-
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_INTERNAL_ERROR,
4579-
sizeof(NX_WEB_HTTP_STATUS_INTERNAL_ERROR) - 1,
4609+
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_BAD_REQUEST,
4610+
sizeof(NX_WEB_HTTP_STATUS_BAD_REQUEST) - 1,
45804611
"NetX HTTP Receive Timeout",
45814612
sizeof("NetX HTTP Receive Timeout") - 1, NX_NULL, 0);
45824613

4583-
/* Error, return to caller. */
4584-
return;
4614+
goto put_process_end;
45854615
}
45864616

45874617
if (server_ptr -> nx_web_http_server_request_chunked)
@@ -4611,12 +4641,28 @@ UINT temp_realm_length = 0;
46114641
/* Release the previous data packet. */
46124642
nx_packet_release(data_packet_ptr);
46134643

4614-
/* Error, return to caller. */
4615-
return;
4644+
goto put_process_end;
46164645
}
46174646

46184647
/* Update the length. */
4619-
length = length - (UINT)(next_packet_ptr -> nx_packet_append_ptr - next_packet_ptr -> nx_packet_prepend_ptr);
4648+
consumed_length = (ULONG)(next_packet_ptr -> nx_packet_append_ptr - next_packet_ptr -> nx_packet_prepend_ptr);
4649+
if ((length - consumed_length) > length)
4650+
{
4651+
/* Underflow error has occurred.*/
4652+
4653+
/* Send response back to HTTP Client. */
4654+
_nx_web_http_server_response_send(server_ptr, NX_WEB_HTTP_STATUS_BAD_REQUEST,
4655+
sizeof(NX_WEB_HTTP_STATUS_BAD_REQUEST) - 1,
4656+
"NetX HTTP Content Length",
4657+
sizeof("NetX HTTP Content Length") - 1, NX_NULL, 0);
4658+
4659+
/* Release the previous data packet. */
4660+
nx_packet_release(data_packet_ptr);
4661+
4662+
status = NX_UNDERFLOW;
4663+
goto put_process_end;
4664+
}
4665+
length -= consumed_length;
46204666

46214667
/* Increment the bytes received count. */
46224668
server_ptr -> nx_web_http_server_total_bytes_received = server_ptr -> nx_web_http_server_total_bytes_received +
@@ -4635,11 +4681,8 @@ UINT temp_realm_length = 0;
46354681
nx_packet_release(data_packet_ptr);
46364682
}
46374683

4638-
/* Success, at this point close the file and prepare a successful response for the client. */
4639-
fx_file_close(&(server_ptr -> nx_web_http_server_file));
4640-
4641-
4642-
/* Now build a response header. */
4684+
/* Build a response header. No need to check for success up to this point, as
4685+
program will have jumped to put_process_end label if an error has occurred. */
46434686
status = _nx_web_http_server_generate_response_header(server_ptr, &data_packet_ptr, NX_WEB_HTTP_STATUS_OK,
46444687
sizeof(NX_WEB_HTTP_STATUS_OK) - 1, 0,
46454688
NX_NULL, 0, NX_NULL, 0);
@@ -4657,7 +4700,10 @@ UINT temp_realm_length = 0;
46574700
nx_packet_release(data_packet_ptr);
46584701
}
46594702
}
4660-
4703+
put_process_end:
4704+
/* Always attempt cleanup by closing the file. */
4705+
fx_file_close(&(server_ptr -> nx_web_http_server_file));
4706+
return;
46614707
}
46624708

46634709

@@ -11350,4 +11396,4 @@ UINT _nx_web_http_server_authentication_check_set(NX_WEB_HTTP_SERVER *http_serve
1135011396

1135111397
/* Return success. */
1135211398
return(NX_SUCCESS);
11353-
}
11399+
}

common/inc/nx_api.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/***************************************************************************
22
* Copyright (c) 2024 Microsoft Corporation
3+
* Copyright (c) 2025-present Eclipse ThreadX Contributors
34
*
45
* This program and the accompanying materials are made available under the
56
* terms of the MIT License which is available at
@@ -109,6 +110,9 @@
109110
/* 03-01-2024 Tiejun Zhou Modified comment(s), */
110111
/* update version number, */
111112
/* resulting in version 6.4.1 */
113+
/* 02-19-2025 Frédéric Desbiens Modified comment(s), */
114+
/* update version number, */
115+
/* resulting in version 6.4.2 */
112116
/* */
113117
/**************************************************************************/
114118

@@ -525,7 +529,7 @@ VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG
525529
#define AZURE_RTOS_NETXDUO
526530
#define NETXDUO_MAJOR_VERSION 6
527531
#define NETXDUO_MINOR_VERSION 4
528-
#define NETXDUO_PATCH_VERSION 1
532+
#define NETXDUO_PATCH_VERSION 2
529533

530534
/* Define the following symbols for backward compatibility */
531535
#define EL_PRODUCT_NETXDUO
@@ -2226,6 +2230,12 @@ typedef struct NX_TCP_LISTEN_STRUCT
22262230
NX_PACKET *nx_tcp_listen_queue_head,
22272231
*nx_tcp_listen_queue_tail;
22282232

2233+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
2234+
/* Define the callback function for notifying the host application of
2235+
a new connect request in the listen queue. */
2236+
VOID (*nx_tcp_listen_queue_notify)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
2237+
#endif
2238+
22292239
/* Define the link between other TCP listen structures created by the application. */
22302240
struct NX_TCP_LISTEN_STRUCT
22312241
*nx_tcp_listen_next,

common/src/nx_tcp_packet_process.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ NX_TCP_SOCKET *socket_ptr;
108108
NX_TCP_HEADER *tcp_header_ptr;
109109
struct NX_TCP_LISTEN_STRUCT *listen_ptr;
110110
VOID (*listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port);
111+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
112+
VOID (*queue_callback)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
113+
#endif
111114
ULONG option_words;
112115
ULONG mss = 0;
113116
ULONG checksum;
@@ -1011,6 +1014,17 @@ ULONG rwin_scale = 0xFF;
10111014
/* Release the packet. */
10121015
_nx_packet_release(packet_ptr);
10131016
}
1017+
1018+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
1019+
/* If extended notify is enabled, call the listen_queue_notify function.
1020+
This user-supplied function notifies the host application of
1021+
a new connect request in the listen queue. */
1022+
queue_callback = listen_ptr -> nx_tcp_listen_queue_notify;
1023+
if (queue_callback)
1024+
{
1025+
(queue_callback)(listen_ptr);
1026+
}
1027+
#endif
10141028
}
10151029

10161030
/* Finished processing, just return. */

nx_secure/inc/nx_secure_tls.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/***************************************************************************
2-
* Copyright (c) 2024 Microsoft Corporation
2+
* Copyright (c) 2024 Microsoft Corporation
3+
* Copyright (c) 2025-present Eclipse ThreadX Contributors
34
*
45
* This program and the accompanying materials are made available under the
56
* terms of the MIT License which is available at
@@ -109,6 +110,12 @@
109110
/* 03-01-2024 Tiejun Zhou Modified comment(s), */
110111
/* update version number, */
111112
/* resulting in version 6.4.1 */
113+
/* 03-01-2024 Tiejun Zhou Modified comment(s), */
114+
/* update version number, */
115+
/* resulting in version 6.4.1 */
116+
/* 02-19-2025 Frédéric Desbiens Modified comment(s), */
117+
/* update version number, */
118+
/* resulting in version 6.4.2 */
112119
/* */
113120
/**************************************************************************/
114121

@@ -172,7 +179,7 @@ extern "C" {
172179
#define AZURE_RTOS_NETX_SECURE
173180
#define NETX_SECURE_MAJOR_VERSION 6
174181
#define NETX_SECURE_MINOR_VERSION 4
175-
#define NETX_SECURE_PATCH_VERSION 1
182+
#define NETX_SECURE_PATCH_VERSION 2
176183

177184
/* The following symbols are defined for backward compatibility reasons. */
178185
#define EL_PRODUCT_NETX_SECURE

nx_secure/src/nxe_secure_tls_session_send.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ UINT status;
9090
return(NX_PTR_ERROR);
9191
}
9292

93+
if (packet_ptr -> nx_packet_length == 0)
94+
{
95+
/* Must check for empty packets here, as TLS data will make a packet's contents
96+
non-empty. _nx_tcp_socket_send_internal has a check for an empty packet
97+
that correctly works in an HTTP session but will result in a false negative if
98+
the session is HTTPS. Thus, this check is performed before the TLS session
99+
operations that modify the packet. */
100+
return(NX_INVALID_PACKET);
101+
}
102+
93103
if (tls_session -> nx_secure_tls_tcp_socket == NX_NULL)
94104
{
95105
return(NX_SECURE_TLS_SESSION_UNINITIALIZED);

test/cmake/crypto/regression/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22
cmake_policy(SET CMP0057 NEW)
33

44
project(regression_test LANGUAGES C)

test/cmake/crypto/regression/crypto_standalone.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22
set(CPU_ARCH "linux")
33
set(COMPILER "gnu")
44

test/cmake/filex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 1312f87f3b90c73c8db3aa1ccbadf15c60fe04bb

0 commit comments

Comments
 (0)