Skip to content

Commit fb56c54

Browse files
ABOSTMfpistm
authored andcommitted
Fix : Wrong _tcp_client[] array initialization
Former "_tcp_client[MAX_CLIENT] = {};" tries to initialize the array element with index MAX_CLIENT, which is out of array range [0 .. (MAX_CLIENT-1)] Fixes warning: warning: array subscript 32 is above array bounds of 'tcp_struct* [32]' [-Warray-bounds] Instead initialize each element of the array one by one. Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent e2e0a42 commit fb56c54

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/EthernetServer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ extern "C" {
99
EthernetServer::EthernetServer(uint16_t port)
1010
{
1111
_port = port;
12-
_tcp_client[MAX_CLIENT] = {};
12+
for (int i = 0; i < MAX_CLIENT; i++) {
13+
_tcp_client[i] = {};
14+
}
1315
_tcp_server = {};
1416
}
1517

0 commit comments

Comments
 (0)